signv2: Do not use path encoding for query values. (#3458)

Use query unescape before comparing signature.
This commit is contained in:
Harshavardhana
2016-12-15 14:56:18 -08:00
committed by GitHub
parent 5c481fbf6e
commit 0db484c8f6
2 changed files with 23 additions and 4 deletions

View File

@@ -22,6 +22,7 @@ func TestResourceListSorting(t *testing.T) {
}
}
// Tests presigned v2 signature.
func TestDoesPresignedV2SignatureMatch(t *testing.T) {
root, err := newTestConfig("us-east-1")
if err != nil {
@@ -76,6 +77,15 @@ func TestDoesPresignedV2SignatureMatch(t *testing.T) {
},
expected: ErrSignatureDoesNotMatch,
},
// (5) Should error when the signature does not match.
{
queryParams: map[string]string{
"Expires": fmt.Sprintf("%d", now.Unix()),
"Signature": "zOM2YrY/yAQe15VWmT78OlBrK6g=",
"AWSAccessKeyId": serverConfig.GetCredential().AccessKeyID,
},
expected: ErrSignatureDoesNotMatch,
},
}
// Run each test case individually.