ChenSammi commented on code in PR #9895:
URL: https://github.com/apache/ozone/pull/9895#discussion_r3025684163


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataReader.java:
##########
@@ -234,8 +235,33 @@ public List<OzoneFileStatus> listStatus(OmKeyArgs args, 
boolean recursive,
 
     try {
       if (isAclEnabled) {
-        checkAcls(getResourceType(args), StoreType.OZONE, ACLType.READ,
-            bucket, args.getKeyName());
+        if (isStsS3Request()) {
+          // We need to be able to tell the difference between being able to 
download a file and merely seeing the file
+          // name in a list.  Use READ for download ability and LIST (here) 
for listing.
+          // When listPrefix is set (original S3 ListObjects prefix), 
authorize LIST on that prefix for the whole
+          // listing, including FSO traversal where keyName is an internal 
directory (e.g. userA) under prefix user.
+          final String listPrefix = args.getListPrefix();
+          final String keyName = args.getKeyName();
+          final String aclKey;
+          if (StringUtils.isNotBlank(listPrefix)) {
+            if (StringUtils.isBlank(keyName)) {
+              aclKey = listPrefix;
+            } else if (isStsListPathUnderRequestPrefix(keyName, listPrefix)) {
+              aclKey = listPrefix;
+            } else {
+              throw new OMException(
+                  "STS listStatus: key path does not match authorized list 
prefix", ResultCodes.PERMISSION_DENIED);

Review Comment:
   Let's include keyName and listPrefix in the exception message, for easy 
debug purpose in future. 



-- 
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]

Reply via email to