Skip to content

Commit 4d3e8fd

Browse files
authored
fix s3 expected bucket owner presigning (#2662)
1 parent 75ab304 commit 4d3e8fd

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "d6a8aa44-4ebf-496e-8554-e58655c3b281",
3+
"type": "bugfix",
4+
"description": "Re-enable hoisting of `X-Amz-Expected-Bucket-Owner` in presigning, but in lowercase form, such that it is correctly enforced.",
5+
"modules": [
6+
"."
7+
]
8+
}

aws/signer/internal/v4/headers.go

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ var RequiredSignedHeaders = Rules{
3838
"X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{},
3939
"X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{},
4040
"X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{},
41-
"X-Amz-Expected-Bucket-Owner": struct{}{},
4241
"X-Amz-Grant-Full-control": struct{}{},
4342
"X-Amz-Grant-Read": struct{}{},
4443
"X-Amz-Grant-Read-Acp": struct{}{},

aws/signer/v4/v4.go

+6
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@ func buildQuery(r v4Internal.Rule, header http.Header) (url.Values, http.Header)
395395
query := url.Values{}
396396
unsignedHeaders := http.Header{}
397397
for k, h := range header {
398+
// literally just this header has this constraint for some stupid reason,
399+
// see #2508
400+
if k == "X-Amz-Expected-Bucket-Owner" {
401+
k = "x-amz-expected-bucket-owner"
402+
}
403+
398404
if r.IsValid(k) {
399405
query[k] = h
400406
} else {

0 commit comments

Comments
 (0)