Files
floci/src/test/java
Wu Shuwenanddajiaohuang 7d96799c5a fix(s3): honor x-amz-bypass-governance-retention in batch DeleteObjects (#3366)
* fix(s3): honor x-amz-bypass-governance-retention in batch DeleteObjects

The batch delete path parsed the request body but never read the
x-amz-bypass-governance-retention header, so the four-argument
deleteObject overload was unreachable from DeleteObjects: every entry was
deleted with bypassGovernance false. A client that sent the header and
held s3:BypassGovernanceRetention still could not permanently delete a
version under GOVERNANCE retention, and got AccessDenied instead. The
singular DeleteObject path reads the header and checks the permission
already, so the two paths disagreed on the same request.

The controller now reads the header for the batch path, checks
s3:BypassGovernanceRetention per entry when it is set, and passes the flag
through a new deleteObjects overload. The two-argument overload is kept
and delegates with false, matching the existing deleteObject overload
ladder.

A second correction in the same response path: an AwsException raised
while deleting an entry was reported as InternalError, because the
catch-all arm ignored the exception's own code. A refusal to delete a
locked version is a per-object AccessDenied on AWS, not a server fault,
and the flattened code hid the retention lock from any client that
branches on it. AwsException now keeps its code; genuinely unexpected
failures still report InternalError.

The regression test covers both directions: without the header the locked
version survives and is reported as AccessDenied, with it the version is
permanently deleted and echoed in Deleted.VersionId.

* fix(s3): scope batch governance bypass permission

---------

Co-authored-by: dajiaohuang <dajiaohuang@users.noreply.github.com>
2026-09-13 15:01:09 -04:00
..