Shuo Huang created HDDS-16408:
---------------------------------

             Summary: S3 Gateway treats DeletePublicAccessBlock as DeleteBucket
                 Key: HDDS-16408
                 URL: https://issues.apache.org/jira/browse/HDDS-16408
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Shuo Huang
            Assignee: Shuo Huang


h3. Problem

When S3 Gateway receives DELETE /\{bucket}?publicAccessBlock, it does not 
recognize the publicAccessBlock subresource and handles the request as 
DeleteBucket.

As a result, the request returns HTTP 204 and deletes an empty bucket. A 
subsequent request for the bucket returns NoSuchBucket.

According to the Amazon S3 API, DeletePublicAccessBlock removes only the 
bucket's PublicAccessBlock configuration. The bucket itself must remain 
unchanged.
h3. Reproduction

Start the packaged Ozone cluster, then run:
{code:bash}
cd <path-to-ceph-s3-tests>
S3TEST_CONF=<path-to-s3tests.conf> python -m pytest -v \
  s3tests/functional/test_s3.py::test_get_undefined_public_block {code}
h3. Actual result

The test receives {{NoSuchBucket}} because the bucket was deleted.
{code:java}
DELETE /bucket?publicAccessBlock -> 204
HEAD /bucket                     -> 404
GET /bucket?publicAccessBlock    -> NoSuchBucket
{code}
h3. Expected result

The request must not be handled as DeleteBucket.

If PublicAccessBlock is unsupported, S3 Gateway should return an appropriate 
unsupported-operation response without modifying the bucket.
h3. Root cause

{{BucketCrudHandler.shouldHandle()}} does not recognize the 
{{publicAccessBlock}} subresource. The request therefore reaches 
{{{}handleDeleteRequest(){}}}, which calls {{{}deleteBucket(bucketName){}}}.
h3. 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]
 * Compatibility report: [https://ozone.s3.peterxcli.dev/]
 * BucketCrudHandler routing: 
[https://github.com/apache/ozone/blob/f9f61847685b15e7aa743079f0ef146053a93d9b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketCrudHandler.java#L47-L52]
 * Bucket deletion call: 
[https://github.com/apache/ozone/blob/f9f61847685b15e7aa743079f0ef146053a93d9b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketCrudHandler.java#L84-L98]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to