You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ss77892 (via GitHub)" <gi...@apache.org> on 2026/05/21 19:58:38 UTC

[PR] HDDS-13855. Move ACL check in Bucket requests to preExecute [ozone]

ss77892 opened a new pull request, #10329:
URL: https://github.com/apache/ozone/pull/10329

   ## Summary
   
   - Move ACL authorization checks for **bucket** operations (`DeleteBucket`, `SetBucketOwner`, `SetBucketProperty`) from `validateAndUpdateCache` to `preExecute`
   - Move ACL checks for bucket ACL operations (`AddAcl`, `RemoveAcl`, `SetAcl`) from `validateAndUpdateCache` to `preExecute`
   - Add audit logging for preExecute ACL failures
   
   ## Motivation
   
   When ACL enforcement happens inside `validateAndUpdateCache`, the request has already been written to the Ratis log on all OM peers. Moving the check to `preExecute` (which runs only on the leader, before log submission) prevents unauthorized requests from polluting the log and ensures consistent ACL rejection across HA leader changes.
   
   ## Test plan
   
   - [ ] Unit tests pass for bucket request handlers
   - [ ] Integration test `TestOMHALeaderSpecificACLEnforcement` covers bucket operations (in a follow-up PR)
   
   ## Related
   
   Part of HDDS-13855. See also:
   - Volume requests (separate PR)
   - Key + Prefix requests (separate PR)
   
   Made with [Cursor](https://cursor.com)


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3378177334


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/acl/OMBucketSetAclRequest.java:
##########
@@ -54,6 +54,7 @@ public class OMBucketSetAclRequest extends OMBucketAclRequest {
 
   @Override
   public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    super.preExecute(ozoneManager);

Review Comment:
   This calls `super.preExecute` which checks the `WRITE_ACL` since it is a SetAcl request, but the other subclasses of `OMBucketAclRequest` (i.e. `OMBucketRemoveAclRequest` and `OMBucketAddAclRequest`) do not call `super.perExecute` (they should not call it).
   
   The `WRITE_ACL` check should remain in `OMBucketSetAclRequest`



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "ss77892 (via GitHub)" <gi...@apache.org>.
ss77892 commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3375523595


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/acl/OMBucketSetAclRequest.java:
##########
@@ -54,6 +54,7 @@ public class OMBucketSetAclRequest extends OMBucketAclRequest {
 
   @Override
   public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    super.preExecute(ozoneManager);

Review Comment:
   Done.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "ss77892 (via GitHub)" <gi...@apache.org>.
ss77892 commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3375520064


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java:
##########
@@ -73,6 +74,35 @@ public OMBucketDeleteRequest(OMRequest omRequest) {
     super(omRequest);
   }
 
+  @Override
+  public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    OMRequest request = super.preExecute(ozoneManager);
+    DeleteBucketRequest deleteBucketRequest =
+        request.getDeleteBucketRequest();
+    String volumeName = deleteBucketRequest.getVolumeName();
+    String bucketName = deleteBucketRequest.getBucketName();
+
+    // ACL check during preExecute
+    if (ozoneManager.getAclsEnabled()) {
+      try {
+        checkAcls(ozoneManager, OzoneObj.ResourceType.BUCKET,
+            OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.DELETE,
+            volumeName, bucketName, null);
+      } catch (IOException ex) {
+        // Ensure audit log captures preExecute failures
+        Map<String, String> auditMap = new LinkedHashMap<>();
+        auditMap.put(OzoneConsts.VOLUME, volumeName);
+        auditMap.put(OzoneConsts.BUCKET, bucketName);
+        markForAudit(ozoneManager.getAuditLogger(),
+            buildAuditMessage(OMAction.DELETE_BUCKET, auditMap, ex,
+                request.getUserInfo()));
+        throw ex;
+      }
+    }
+
+    return request;

Review Comment:
   Hm. OMBucketDeleteRequest extends OMClientRequest and doesn't perform any additional ACL checks in the preExecute. Have I missed something?
   



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13855. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3322252623


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/acl/OMBucketSetAclRequest.java:
##########
@@ -54,6 +54,7 @@ public class OMBucketSetAclRequest extends OMBucketAclRequest {
 
   @Override
   public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    super.preExecute(ozoneManager);

Review Comment:
   Please address this comment from Copilot - 
   https://github.com/apache/ozone/pull/9653/changes#r3076604122
   
   > Now that this method calls super.preExecute(ozoneManager), OMClientRequest.preExecute will already populate UserInfo via getUserIfNotExists(). The method later rebuilds the request and sets UserInfo again via getUserInfo(), which can drop that fallback in non-RPC/internal call paths (Server.getRemoteUser() may be null). Consider capturing the OMRequest returned by super.preExecute and building from it without overriding UserInfo, or switch the later setUserInfo call to getUserIfNotExists(ozoneManager).



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10329:
URL: https://github.com/apache/ozone/pull/10329#issuecomment-4920365129

   Thank you for your contribution. This PR is being closed due to inactivity. Please contact a maintainer if you would like to reopen it.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13855. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3322252623


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/acl/OMBucketSetAclRequest.java:
##########
@@ -54,6 +54,7 @@ public class OMBucketSetAclRequest extends OMBucketAclRequest {
 
   @Override
   public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    super.preExecute(ozoneManager);

Review Comment:
   Please address this comment from Copilot - 
   https://github.com/apache/ozone/pull/9653/changes#r3076604122



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3357114812


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java:
##########
@@ -73,6 +74,35 @@ public OMBucketDeleteRequest(OMRequest omRequest) {
     super(omRequest);
   }
 
+  @Override
+  public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    OMRequest request = super.preExecute(ozoneManager);
+    DeleteBucketRequest deleteBucketRequest =
+        request.getDeleteBucketRequest();
+    String volumeName = deleteBucketRequest.getVolumeName();
+    String bucketName = deleteBucketRequest.getBucketName();
+
+    // ACL check during preExecute
+    if (ozoneManager.getAclsEnabled()) {
+      try {
+        checkAcls(ozoneManager, OzoneObj.ResourceType.BUCKET,
+            OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.DELETE,
+            volumeName, bucketName, null);
+      } catch (IOException ex) {
+        // Ensure audit log captures preExecute failures
+        Map<String, String> auditMap = new LinkedHashMap<>();
+        auditMap.put(OzoneConsts.VOLUME, volumeName);
+        auditMap.put(OzoneConsts.BUCKET, bucketName);
+        markForAudit(ozoneManager.getAuditLogger(),
+            buildAuditMessage(OMAction.DELETE_BUCKET, auditMap, ex,
+                request.getUserInfo()));
+        throw ex;
+      }
+    }
+
+    return request;

Review Comment:
   Previously, we only check ACLType.DELETE, but since super.preExecute check AclType.WRITE_ACL, won't there be a regession?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3378168526


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java:
##########
@@ -73,6 +74,35 @@ public OMBucketDeleteRequest(OMRequest omRequest) {
     super(omRequest);
   }
 
+  @Override
+  public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    OMRequest request = super.preExecute(ozoneManager);
+    DeleteBucketRequest deleteBucketRequest =
+        request.getDeleteBucketRequest();
+    String volumeName = deleteBucketRequest.getVolumeName();
+    String bucketName = deleteBucketRequest.getBucketName();
+
+    // ACL check during preExecute
+    if (ozoneManager.getAclsEnabled()) {
+      try {
+        checkAcls(ozoneManager, OzoneObj.ResourceType.BUCKET,
+            OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.DELETE,
+            volumeName, bucketName, null);
+      } catch (IOException ex) {
+        // Ensure audit log captures preExecute failures
+        Map<String, String> auditMap = new LinkedHashMap<>();
+        auditMap.put(OzoneConsts.VOLUME, volumeName);
+        auditMap.put(OzoneConsts.BUCKET, bucketName);
+        markForAudit(ozoneManager.getAuditLogger(),
+            buildAuditMessage(OMAction.DELETE_BUCKET, auditMap, ex,
+                request.getUserInfo()));
+        throw ex;
+      }
+    }
+
+    return request;

Review Comment:
   My mistake, should be fine.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3378177334


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/acl/OMBucketSetAclRequest.java:
##########
@@ -54,6 +54,7 @@ public class OMBucketSetAclRequest extends OMBucketAclRequest {
 
   @Override
   public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    super.preExecute(ozoneManager);

Review Comment:
   This calls `super.preExecute` which checks the `WRITE_ACL` since it is a SetAcl request, but the other subclasses of `OMBucketAclRequest` (i.e. `OMBucketRemoveAclRequest` and `OMBucketAddAclRequest`) do not call `super.perExecute` (they should not call it). Seems awkward.
   
   The `WRITE_ACL` check should remain in `OMBucketSetAclRequest`



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10329:
URL: https://github.com/apache/ozone/pull/10329#issuecomment-4849099668

   This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3378168526


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java:
##########
@@ -73,6 +74,35 @@ public OMBucketDeleteRequest(OMRequest omRequest) {
     super(omRequest);
   }
 
+  @Override
+  public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    OMRequest request = super.preExecute(ozoneManager);
+    DeleteBucketRequest deleteBucketRequest =
+        request.getDeleteBucketRequest();
+    String volumeName = deleteBucketRequest.getVolumeName();
+    String bucketName = deleteBucketRequest.getBucketName();
+
+    // ACL check during preExecute
+    if (ozoneManager.getAclsEnabled()) {
+      try {
+        checkAcls(ozoneManager, OzoneObj.ResourceType.BUCKET,
+            OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.DELETE,
+            volumeName, bucketName, null);
+      } catch (IOException ex) {
+        // Ensure audit log captures preExecute failures
+        Map<String, String> auditMap = new LinkedHashMap<>();
+        auditMap.put(OzoneConsts.VOLUME, volumeName);
+        auditMap.put(OzoneConsts.BUCKET, bucketName);
+        markForAudit(ozoneManager.getAuditLogger(),
+            buildAuditMessage(OMAction.DELETE_BUCKET, auditMap, ex,
+                request.getUserInfo()));
+        throw ex;
+      }
+    }
+
+    return request;

Review Comment:
   My mistake, should be fine for this. I was referring to `OMBucketAclRequest` changes.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "ivandika3 (via GitHub)" <gi...@apache.org>.
ivandika3 commented on code in PR #10329:
URL: https://github.com/apache/ozone/pull/10329#discussion_r3378187656


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/acl/OMBucketSetAclRequest.java:
##########
@@ -54,6 +54,7 @@ public class OMBucketSetAclRequest extends OMBucketAclRequest {
 
   @Override
   public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
+    super.preExecute(ozoneManager);

Review Comment:
   Also please address similar issue in volume ACL check. https://github.com/apache/ozone/pull/10328#discussion_r3357123279



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-15461. Move ACL check in Bucket requests to preExecute [ozone]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #10329: HDDS-15461. Move ACL check in Bucket requests to preExecute
URL: https://github.com/apache/ozone/pull/10329


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org