s3: accept the governance bypass header case-insensitively (#12667)

* s3: accept the governance bypass header case-insensitively

botocore and the AWS CLI send x-amz-bypass-governance-retention: True,
so the exact "true" match ignored the bypass and governance-locked
deletes and retention changes failed with AccessDenied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3: test governance bypass with SDK-style header values

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-11-15 13:18:19 -08:00
1 parent c0509cf499
commit c09009a74f
6 files changed
+65 -10

No files matched your search

@@ -520,6 +520,14 @@ func TestValidateObjectLockHeaders(t *testing.T) {
assert.True(t, errors.Is(err, ErrGovernanceBypassVersioningRequired))
})
t.Run("Title-case governance bypass header on non-versioned bucket", func(t *testing.T) {
req := httptest.NewRequest("PUT", "/bucket/object", nil)
req.Header.Set("x-amz-bypass-governance-retention", "True")
err := s3a.validateObjectLockHeaders(req, "bucket", "object", false)
assert.True(t, errors.Is(err, ErrGovernanceBypassVersioningRequired))
})
t.Run("Governance bypass header on versioned bucket should pass", func(t *testing.T) {
req := httptest.NewRequest("PUT", "/bucket/object", nil)
req.Header.Set("x-amz-bypass-governance-retention", "true")