-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Add X-Amz-Object-Lock-* as unhoisted presign headers (#…
…3968) Updates the SigV4 signer to exclude the X-Amz-Object-Lock- group of headers to not be signed as a part of the query string for presigned URLs. Related to aws/aws-sdk-go-v2#1307
- Loading branch information
Showing
5 changed files
with
57 additions
and
17 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
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,37 @@ | ||
// +build go1.7 | ||
|
||
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) | ||
} | ||
}) | ||
} | ||
} |
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