fmorg-git commented on code in PR #9899:
URL: https://github.com/apache/ozone/pull/9899#discussion_r3066286033
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/acl/iam/IamSessionPolicyResolver.java:
##########
@@ -548,12 +552,16 @@ private static void processBucketResource(String
volumeName, Set<S3Action> mappe
if (action == S3Action.LIST_BUCKET || action == S3Action.ALL_S3) {
// If condition prefixes are present, these would constrain the object
permissions if the action
// is s3:ListBucket or s3:* (which includes s3:ListBucket)
- if (prefixes != null && !prefixes.isEmpty()) {
- for (String prefix : prefixes) {
+ if (condition != null && condition.prefixes != null &&
!condition.prefixes.isEmpty()) {
+ for (String prefix : condition.prefixes) {
+ // If operator is StringEquals, we should ignore any prefix
containing wildcards
+ if (STRING_EQUALS.equals(condition.operator) &&
hasWildcard(prefix)) {
+ continue;
Review Comment:
so I tested that this is in accordance with AWS behavior. If there are
multiple values for `s3:prefix` with `StringEquals` operator and one of them
has wildcard and one of them does not, the one without the wildcard will be
used. If there is only one value and it has a wildcard, the token will deny
access to everything.
I actually have smoke tests in a later PR to confirm this:
https://github.com/apache/ozone/pull/9902/changes#diff-9618645b4805b3f470a54f8fc0c8d031ce9f86b142b7b0f2ab1bc327291d5aa4R137-R157
I added a quick commit to clarify in the comment that this is AWS behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]