-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-11732. Skip ACL check on bucket resolution while reading from snapshot #7446
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4402,10 +4402,16 @@ public ResolvedBucket resolveBucketLink(Pair<String, String> requested, | |
| } | ||
|
|
||
| public ResolvedBucket resolveBucketLink(Pair<String, String> requested, | ||
| boolean allowDanglingBuckets) | ||
| boolean allowDanglingBuckets) throws IOException { | ||
| return resolveBucketLink(requested, allowDanglingBuckets, isAclEnabled); | ||
| } | ||
|
|
||
| public ResolvedBucket resolveBucketLink(Pair<String, String> requested, | ||
| boolean allowDanglingBuckets, | ||
| boolean aclEnabled) | ||
| throws IOException { | ||
| OmBucketInfo resolved; | ||
| if (isAclEnabled) { | ||
| if (aclEnabled) { | ||
| UserGroupInformation ugi = getRemoteUser(); | ||
| if (getS3Auth() != null) { | ||
| ugi = UserGroupInformation.createRemoteUser( | ||
|
|
@@ -4416,15 +4422,26 @@ public ResolvedBucket resolveBucketLink(Pair<String, String> requested, | |
| ugi, | ||
| remoteIp != null ? remoteIp : omRpcAddress.getAddress(), | ||
| remoteIp != null ? remoteIp.getHostName() : | ||
| omRpcAddress.getHostName(), allowDanglingBuckets); | ||
| omRpcAddress.getHostName(), allowDanglingBuckets, aclEnabled); | ||
| } else { | ||
| resolved = resolveBucketLink(requested, new HashSet<>(), | ||
| null, null, null, allowDanglingBuckets); | ||
| null, null, null, allowDanglingBuckets, aclEnabled); | ||
| } | ||
| return new ResolvedBucket(requested.getLeft(), requested.getRight(), | ||
| resolved); | ||
| } | ||
|
|
||
| private OmBucketInfo resolveBucketLink( | ||
| Pair<String, String> volumeAndBucket, | ||
| Set<Pair<String, String>> visited, | ||
| UserGroupInformation userGroupInformation, | ||
| InetAddress remoteAddress, | ||
| String hostName, | ||
| boolean allowDanglingBuckets) throws IOException { | ||
| return resolveBucketLink(volumeAndBucket, visited, userGroupInformation, remoteAddress, hostName, | ||
| allowDanglingBuckets, isAclEnabled); | ||
| } | ||
|
|
||
| /** | ||
| * Resolves bucket symlinks. Read permission is required for following links. | ||
| * | ||
|
|
@@ -4442,7 +4459,8 @@ private OmBucketInfo resolveBucketLink( | |
| UserGroupInformation userGroupInformation, | ||
| InetAddress remoteAddress, | ||
| String hostName, | ||
| boolean allowDanglingBuckets) throws IOException { | ||
| boolean allowDanglingBuckets, | ||
| boolean aclEnabled) throws IOException { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
|
|
||
| String volumeName = volumeAndBucket.getLeft(); | ||
| String bucketName = volumeAndBucket.getRight(); | ||
|
|
@@ -4465,7 +4483,7 @@ private OmBucketInfo resolveBucketLink( | |
| DETECTED_LOOP_IN_BUCKET_LINKS); | ||
| } | ||
|
|
||
| if (isAclEnabled) { | ||
| if (aclEnabled) { | ||
| final ACLType type = ACLType.READ; | ||
| checkAcls(ResourceType.BUCKET, StoreType.OZONE, type, | ||
| volumeName, bucketName, null, userGroupInformation, | ||
|
|
@@ -4476,7 +4494,7 @@ private OmBucketInfo resolveBucketLink( | |
| return resolveBucketLink( | ||
| Pair.of(info.getSourceVolume(), info.getSourceBucket()), | ||
| visited, userGroupInformation, remoteAddress, hostName, | ||
| allowDanglingBuckets); | ||
| allowDanglingBuckets, aclEnabled); | ||
| } | ||
|
|
||
| @VisibleForTesting | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @swamirishi for the patch.
As long as we make sure
getActiveFsMetadataOrSnapshot()can ONLY be called by a privileged user that has admin permission, I am good with this. According to your updated PR description that seems to be the case here.Because otherwise it becomes a potential security hole (info leak).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the above comment since we are skipping ACL check now.