Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSP]Bucket access by users of tenants #1304

Merged
merged 6 commits into from
Aug 27, 2021

Conversation

vineela1999
Copy link
Contributor

@vineela1999 vineela1999 commented Aug 12, 2021

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind new feature

/kind bug fix

/kind cleanup
/kind revert change
/kind design
/kind documentation
/kind enhancement

What this PR does / why we need it:

  • This PR solves the problem that when an user is getting switched from a tenant to other tenant which it is a part of ,the S3 API is using inappropriate tenantID(ProjectID).Because of this ,bucket operations like create bucket ,list buckets are using inappropriate tenantID and access of buckets is handled in a wrong way(example: as in issue disscused in issue [SSP]When an User is assigned to two tenants, buckets created in one tenant are accessible in other tenant by same user #1303 )

  • Also validation is taken care when a backend is requested to delete it checks whether the backend is associated with any SSP and warning is given

  • Validation that when an update tier is requested need to check whether the delete backends has any buckets in them

Which issue(s) this PR fixes:

Fixes #1303
Fixes #1297 (partially)

Test Report Added?:

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind TESTED

/kind NOT-TESTED

Test Report:

tenant1 users:
Screenshot from 2021-08-13 13-35-23
tenant2 users:
Screenshot from 2021-08-13 13-35-32
User3 as tenant1 is listing buckets created in tenant1 only:
Screenshot from 2021-08-13 13-36-24
User3 as tenant2 is listing buckets created in tenant2 only but not tenant1 buckets:
Screenshot from 2021-08-13 13-36-34
When trying to delete backend which is associated with an SSP(tier)
Screenshot from 2021-08-18 22-35-11
**When trying to delete a backend(with buckets) from tier backends **
Screenshot from 2021-08-18 22-37-14

Special notes for your reviewer:
In a scenario where an user is a part of multiple tenants, AK/SK is common but the authtoken varies
So we need to extract userId and tenantID using authtoken
In the existing S3API, x-auth-token value in the request is not validated.
And tenantID and userID are extracted and set as context using AK/SK in the signature filter
so we need to add auth filter where the validation of authtoken is done and tenantID and userId are extracted and set in the context using authtoken.

@codecov
Copy link

codecov bot commented Aug 12, 2021

Codecov Report

Merging #1304 (e7821b1) into master (16c97b4) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1304   +/-   ##
=======================================
  Coverage   48.12%   48.12%           
=======================================
  Files          10       10           
  Lines        1571     1571           
=======================================
  Hits          756      756           
  Misses        756      756           
  Partials       59       59           

Copy link
Contributor

@rajat-soda rajat-soda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

for _, tier := range tiersList.Tiers {
res := utils.ResourcesAlreadyExists(tier.Backends, id_array)
if len(res) != 0 {
errMsg := fmt.Sprintf("failed to delete backend because it is associated with some SSP")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

associated with some SSP => associated with another SSP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Copy link
Collaborator

@kumarashit kumarashit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rajat-soda
Copy link
Contributor

LGTM

Copy link
Member

@NajmudheenCT NajmudheenCT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NajmudheenCT NajmudheenCT merged commit b6272f8 into sodafoundation:master Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants