Skip to content

HDDS-16187. [STS] Fix Latent S3 DeleteObjects Issue - #11019

Merged
ChenSammi merged 2 commits into
apache:HDDS-13323-stsfrom
fmorg-git:HDDS-16187
Aug 17, 2026
Merged

HDDS-16187. [STS] Fix Latent S3 DeleteObjects Issue#11019
ChenSammi merged 2 commits into
apache:HDDS-13323-stsfrom
fmorg-git:HDDS-16187

Conversation

@fmorg-git

@fmorg-git fmorg-git commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Please describe your PR in detail:

  • DeleteObjects returns HTTP 500 instead of AccessDenied when the user doesn't have the proper access. Because the latent S3 API has this defect, then when using STS tokens, the same issue appears. This ticket addresses the issue.

What is the link to the Apache JIRA

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

How was this patch tested?

smoke tests

@fmorg-git
fmorg-git marked this pull request as draft August 14, 2026 06:10
@fmorg-git
fmorg-git marked this pull request as ready for review August 14, 2026 17:45

@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 for the patch! @fmorg-git The AccessDenied translation looks correct.

I left a few inline comments, mostly around the cases the new handling doesn't cover yet and the audit record on the throw path.

Also, could we add a unit test alongside the smoke test? TestPermissionCheck#testDeleteKeys already has the mocks needed.

} catch (IOException ex) {
LOG.error("Delete key failed: {}", ex.getMessage());
getMetrics().updateDeleteKeyFailureStats(startNanos);
final OMException omEx = (OMException) HddsClientUtils.containsException(ex, OMException.class);

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.

Currently, we only handle ACCESS_DENIED, and non-ACCESS_DENIED OM errors still return HTTP 200 with ALL/InternalError. Should we translate every contained OMException here so that errors like TOKEN_EXPIRED and BUCKET_NOT_FOUND retain their S3 response?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated - fc80f77

getMetrics().updateDeleteKeyFailureStats(startNanos);
final OMException omEx = (OMException) HddsClientUtils.containsException(ex, OMException.class);
if (omEx != null && S3ErrorTable.translateResultCode(omEx) == S3ErrorTable.ACCESS_DENIED) {
throw newError(S3ErrorTable.ACCESS_DENIED, bucketName, omEx);

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.

This throw skips the audit block below, so rejected multi-delete requests leave no failure audit record. I wonder if we should audit the failure before propagating it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated - fc80f77

@fmorg-git

Copy link
Copy Markdown
Contributor Author

Thanks for the patch! @fmorg-git The AccessDenied translation looks correct.

I left a few inline comments, mostly around the cases the new handling doesn't cover yet and the audit record on the throw path.

Also, could we add a unit test alongside the smoke test? TestPermissionCheck#testDeleteKeys already has the mocks needed.

Updated to add unit tests - fc80f77

@fmorg-git
fmorg-git requested a review from chihsuan August 16, 2026 09:46
@ChenSammi
ChenSammi requested a lite review from Copilot and removed request for chihsuan August 17, 2026 04:20

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.

Pull request overview

This PR fixes an S3 Gateway behavior where DeleteObjects could return HTTP 500 when OM permission/STS token failures were surfaced as an IOException wrapping an OMException. The change ensures those OM failures are detected and translated into the appropriate S3 error response (e.g., AccessDenied, ExpiredToken), aligning behavior for latent S3 and STS-backed requests.

Changes:

  • Translate IOException-wrapped OMException failures during BucketEndpoint#multiDelete into proper S3 errors instead of returning an internal error response.
  • Centralize MultiDelete failure audit logging into a helper method and ensure it’s invoked for translated OM failures.
  • Add unit and smoke-test coverage for STS session policies denying DeleteObjects.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java Detects wrapped OMException during multi-delete and maps it to the correct OS3Exception/S3 error; refactors audit failure logging.
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestPermissionCheck.java Adds parameterized coverage to verify DeleteObjects translates contained OM failures (access denied, expired token, no such bucket).
hadoop-ozone/dist/src/main/smoketest/security/ozone-secure-sts.robot Adds an STS smoke test asserting a GetObject-only session policy denies DeleteObjects (expects AccessDenied).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

LGTM. Wait for the CI to pass.

Thanks @fmorg-git , and @chihsuan for the review.

@ChenSammi
ChenSammi merged commit 113e3d0 into apache:HDDS-13323-sts Aug 17, 2026
84 of 89 checks passed
@fmorg-git

Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge.

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.

4 participants