mirror of
https://github.com/minio/minio.git
synced 2025-01-14 00:05:02 -05:00
fix: ignore signaturev2 for policy header check (#19551)
This commit is contained in:
parent
cd50e9b4bc
commit
9205434ed3
@ -610,7 +610,6 @@ func newPostRequestV2(endPoint, bucketName, objectName string, accessKey, secret
|
|||||||
"key": objectName + "/${filename}",
|
"key": objectName + "/${filename}",
|
||||||
"policy": encodedPolicy,
|
"policy": encodedPolicy,
|
||||||
"signature": signature,
|
"signature": signature,
|
||||||
"X-Amz-Ignore-signature": "",
|
|
||||||
"X-Amz-Ignore-AWSAccessKeyId": "",
|
"X-Amz-Ignore-AWSAccessKeyId": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +347,11 @@ func checkPostPolicy(formValues http.Header, postPolicyForm PostPolicyForm) erro
|
|||||||
}
|
}
|
||||||
delete(checkHeader, formCanonicalName)
|
delete(checkHeader, formCanonicalName)
|
||||||
}
|
}
|
||||||
|
// For SignV2 - Signature field will be ignored
|
||||||
|
// Policy is generated from Signature with other fields, so it should be ignored
|
||||||
|
if _, ok := formValues[xhttp.AmzSignatureV2]; ok {
|
||||||
|
delete(checkHeader, xhttp.AmzSignatureV2)
|
||||||
|
}
|
||||||
|
|
||||||
if len(checkHeader) != 0 {
|
if len(checkHeader) != 0 {
|
||||||
logKeys := make([]string, 0, len(checkHeader))
|
logKeys := make([]string, 0, len(checkHeader))
|
||||||
|
@ -154,7 +154,7 @@ func getSignature(signingKey []byte, stringToSign string) string {
|
|||||||
// Check to see if Policy is signed correctly.
|
// Check to see if Policy is signed correctly.
|
||||||
func doesPolicySignatureMatch(formValues http.Header) (auth.Credentials, APIErrorCode) {
|
func doesPolicySignatureMatch(formValues http.Header) (auth.Credentials, APIErrorCode) {
|
||||||
// For SignV2 - Signature field will be valid
|
// For SignV2 - Signature field will be valid
|
||||||
if _, ok := formValues["Signature"]; ok {
|
if _, ok := formValues[xhttp.AmzSignatureV2]; ok {
|
||||||
return doesPolicySignatureV2Match(formValues)
|
return doesPolicySignatureV2Match(formValues)
|
||||||
}
|
}
|
||||||
return doesPolicySignatureV4Match(formValues)
|
return doesPolicySignatureV4Match(formValues)
|
||||||
|
Loading…
Reference in New Issue
Block a user