Skip to content

HDDS-16408. Prevent DeletePublicAccessBlock from deleting buckets - #11236

Open
F64116045 wants to merge 1 commit into
apache:masterfrom
F64116045:HDDS-16408
Open

F64116045 wants to merge 1 commit into
apache:masterfrom
F64116045:HDDS-16408

Conversation

@F64116045

@F64116045 F64116045 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

S3 Gateway does not recognize the publicAccessBlock query parameter. As a result, DELETE /{bucket}?publicAccessBlock is routed to DeleteBucket and deletes an empty bucket.

Ozone does not support Public Access Block yet, but this request should not delete the bucket. This change excludes publicAccessBlock requests from the regular bucket deletion path, so the request returns 501 NotImplemented and the bucket remains unchanged.

References
AWS DeletePublicAccessBlock API: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeletePublicAccessBlock.html
ceph/s3-tests: test_get_undefined_public_block:
https://github.com/ceph/s3-tests/blob/fb8b73092bb1dd8db829f1205a9e52e73bf9a232/s3tests/functional/test_s3.py#L13830-L13847

What is the link to the Apache JIRA

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

How was this patch tested?

mvn -pl hadoop-ozone/s3gateway \
  -Dtest=TestBucketDelete test
mvn -pl hadoop-ozone/integration-test-s3 -am \
  -DskipDocs -DskipShade -Dskip.npm \
  -Dtest=TestS3SDK \
  -Dsurefire.failIfNoSpecifiedTests=false test

CI: https://github.com/F64116045/ozone/actions/runs/34764029942

@F64116045
F64116045 marked this pull request as ready for review September 13, 2026 23:00

@chihsuan chihsuan 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.

Thanks @F64116045 overall, the fix looks good. I left two inline comments.

Slightly out of scope, but DELETE ?policy, ?cors and others still fall through to DeleteBucket. Could we list all the remaining bucket subresources at once? A follow-up Jira would work too.

&& queryParams().get(QueryParams.TAGGING) == null
&& queryParams().get(QueryParams.LIFECYCLE) == null;
&& queryParams().get(QueryParams.LIFECYCLE) == null
&& queryParams().get(QueryParams.PUBLIC_ACCESS_BLOCK) == null;

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.

Have you considered a small handler before BucketCrudHandler, similar to BucketGetLocationHandler? It would also cover GET ?publicAccessBlock, which still returns a listing today, and other unsupported subresources could join it later.

*
* This handler processes bucket-level requests that do not target
* specific subresources (such as {@code ?acl}, {@code ?uploads},
* {@code ?delete} or {@code ?tagging}), which are handled by dedicated handlers.

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.

nit: The class javadoc above is missing ?lifecycle and ?publicAccessBlock. Maybe drop the examples and describe the rule instead? They go stale easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants