Skip to content

HDDS-17298. Return INVALID_REQUEST for malformed ACLs in OM requests - #11683

Draft
smengcl wants to merge 5 commits into
apache:masterfrom
smengcl:HDDS-17298
Draft

smengcl wants to merge 5 commits into
apache:masterfrom
smengcl:HDDS-17298

Conversation

@smengcl

@smengcl smengcl commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

What changes were proposed in this pull request?

OM converts the ACLs sent with key, file, directory, multipart upload, bucket and volume create requests (KeyArgs.acls, BucketInfo.acls, VolumeInfo.volumeAcls) with OzoneAcl.fromProtobuf only in validateAndUpdateCache. An ACL with an empty user or group name, a WORLD or ANONYMOUS ACL with another name, or rights longer than 4 bytes fails there with an IllegalArgumentException or AssertionError instead of an OMException with a result code.

Rights bits beyond the known ACL types are accepted by all requests that carry ACLs, including AddAcl, SetAcl and RemoveAcl. IAccessAuthorizer.ACLType.getACLString (used by OzoneAcl.toString, for example in audit logs) then fails with an ArrayIndexOutOfBoundsException, and so does OzoneAclStorage.fromProtobuf when reading such a prefix ACL from the prefix table. The latter also fails for a prefix ACL without any rights.

This PR:

  • adds OMClientRequest.toOzoneAcls, which converts client ACLs and throws OMException with INVALID_REQUEST for a malformed one, and OMClientRequest.checkAclRights, which does the same for rights beyond the known ACL types;
  • calls toOzoneAcls in preExecute of the create requests (OMKeyRequest.resolveBucketAndCheckKeyAcls, shared by key, file, directory and multipart upload requests, plus OMBucketCreateRequest and OMVolumeCreateRequest), and checkAclRights in preExecute of the volume, bucket, key and prefix AddAcl, SetAcl and RemoveAcl requests, so such ACLs are rejected before the request is replicated;
  • uses toOzoneAcls in validateAndUpdateCache of the create requests (OMKeyRequest.getAclsForKey and getAclsForDir, OMBucketCreateRequest, OMVolumeCreateRequest), so such a request also gets an error response there. OMBucketCreateRequest and OMVolumeCreateRequest now set the client ACLs inside the try block instead of in OmBucketInfo.getFromProtobuf and OmVolumeArgs.builderFromProtobuf;
  • skips both of the above when ozone.om.object.creation.ignore.client.acls is true, so the create requests ignore the client ACLs without validating them;
  • makes ACLType.getACLString and OzoneAclStorage.fromProtobuf skip unknown rights bits, and the latter accept no rights, so existing ACLs can still be printed and read;
  • throws IllegalArgumentException instead of AssertionError in OzoneAcl.fromProtobuf for rights longer than 4 bytes.

The Ozone client and the S3 Gateway build ACLs that already pass this validation, so they see no difference. No protocol, version or layout change.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-17298

How was this patch tested?

  • New testInvalidAcl in TestOMKeyCreateRequest (and so TestOMKeyCreateRequestWithFSO), TestOMBucketCreateRequest and TestOMVolumeCreateRequest, and testRejectInvalidAcl in TestOMDirectoryCreateRequest, for the malformed ACLs in OMRequestTestUtils.invalidAcls(). By default, each checks that preExecute fails with INVALID_REQUEST, and that validateAndUpdateCache returns INVALID_REQUEST for an already pre-executed request with such an ACL. testInvalidAcl also checks that the request succeeds when client ACLs are ignored.
  • New testRejectUnknownAclRights in TestOMKeyAclRequest (and so TestOMKeyAclRequestWithFSO), TestOMPrefixAclRequest, TestOMBucketAddAclRequest and TestOMVolumeAddAclRequest: preExecute fails with INVALID_REQUEST, and validateAndUpdateCache completes with its usual result.
  • New TestOzoneAcls#testToStringIgnoresUnknownRights and TestOmPrefixInfo#testGetFromProtobufWithUnknownOrNoRights.
  • Each new test fails without the change. The touched test classes in ozone-common, ozone-interface-storage and ozone-manager pass locally.

🤖 Generated with Claude Code

…quests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 22, 2026 07:59
@smengcl smengcl added the om label Oct 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@smengcl smengcl changed the title HDDS-17298. Return INVALID_REQUEST for malformed ACLs in OM create requests HDDS-17298. Return INVALID_REQUEST for malformed ACLs in OM requests Oct 22, 2026
@jojochuang

Copy link
Copy Markdown
Contributor

Looks good.

  • Both legacy and new, split-part-table approach are supported.
  • backward compatible
  • looks like read/write throughput shouldn't be impacted
  • a real upgrade compatibility test would be nice. There's one upgrade test but client and server still run the new implementation. Can defer to a future task.

@jojochuang
jojochuang requested a lite review from Copilot October 23, 2026 17:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues

Review effort: Lite

Co-authored-by: Codex (GPT-6)
Change-Id: I5fea7356b90fef65e1b6ccb19bf9d747c5c6bdea
Co-authored-by: Codex (GPT-6)
Change-Id: I599f736ba48aa02b92e0ed00cdf38e7fad4f35b3
Co-authored-by: Codex (GPT-6)
Change-Id: If1348d6868bf87be117809a3728d9dc312e00c3c
Co-authored-by: Codex (GPT-6)
Change-Id: I561a7b800d879c29f9151331e8a716abda6207ee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants