HDDS-15137. [STS] Ensure each S3 API has an associated S3 Action#10197
Draft
fmorg-git wants to merge 2 commits intoapache:HDDS-13323-stsfrom
Draft
HDDS-15137. [STS] Ensure each S3 API has an associated S3 Action#10197fmorg-git wants to merge 2 commits intoapache:HDDS-13323-stsfrom
fmorg-git wants to merge 2 commits intoapache:HDDS-13323-stsfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please describe your PR in detail:
HeadObjectandGetObjectS3 apis are associated with "s3:GetObject" action. The actions will not have the s3: prefix when used internally in Ozone and Ranger.Most apis have a 1-1 mapping with api and action like the
HeadObjectandGetObjectapis mentioned previously. In order to avoid having to update multiple call sites, anS3GActionIamMapperis introduced to leverage the already existing api audit functionality and map api names to actions in a thread local (S3Authentication.getS3Action()). Then inOmMetadataReader.checkAcls(), themaybeAttachS3ActionFromThreadLocalfunction is used to read the thread local and set the s3Action in the RequestContext if it exists.However,
CopyObjectandUploadPartCopyare special cases. There is no "s3:CopyObject" nor "s3:UploadPartCopy" action, but rather they both require "s3:GetObject" action on the source object and "s3:PutObject" action on the destination object. For these special cases, a helper methodrunWithS3ActionStringis introduced inEndpointBase.javaso the proper permissions can be checked on the source and on the destination by temporarily overriding the value in the thread local while the operation is invoked, then setting it back to the previous value when done.Additionally, this ticket contains additional fixes found after testing with these new changes. For example, since we now have fine-grained actions, we no longer need to distinguish listing files permission vs download files permission with LIST acl vs READ acl. Both apis can use READ acl.
This PR depends on #10009
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15137
How was this patch tested?
unit tests, smoke tests