-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aws/signer/v4: Keep Object-Lock headers a header in presigning signin…
…g requests (#1307) Updates the Sigv4 request signer to use keep X-Amz-Object-Lock-* headers as headers, and not hoisted to the query string for presigned URLs. Revision of #1215
- Loading branch information
Showing
4 changed files
with
57 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "4b776031-a695-41ca-a111-950fd7dbe4fa", | ||
"type": "bugfix", | ||
"description": "Keep Object-Lock headers a header when presigning Sigv4 signing requests", | ||
"modules": [ | ||
"." | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package v4 | ||
|
||
import "testing" | ||
|
||
func TestAllowedQueryHoisting(t *testing.T) { | ||
cases := map[string]struct { | ||
Header string | ||
ExpectHoist bool | ||
}{ | ||
"object-lock": { | ||
Header: "X-Amz-Object-Lock-Mode", | ||
ExpectHoist: false, | ||
}, | ||
"s3 metadata": { | ||
Header: "X-Amz-Meta-SomeName", | ||
ExpectHoist: false, | ||
}, | ||
"another header": { | ||
Header: "X-Amz-SomeOtherHeader", | ||
ExpectHoist: true, | ||
}, | ||
"non X-AMZ header": { | ||
Header: "X-SomeOtherHeader", | ||
ExpectHoist: false, | ||
}, | ||
} | ||
|
||
for name, c := range cases { | ||
t.Run(name, func(t *testing.T) { | ||
if e, a := c.ExpectHoist, AllowedQueryHoisting.IsValid(c.Header); e != a { | ||
t.Errorf("expect hoist %v, was %v", e, a) | ||
} | ||
}) | ||
} | ||
} |