mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
do not check for query params to be signed headers (#18283)
x-amz-signed-headers is meant for HTTP headers only not for query params, using that to verify things further can lead to failure. The generated presigned URL with custom metadata is already kosher (tamper proof). fixes #18281
This commit is contained in:
parent
c5636143c6
commit
780882efcf
@ -273,15 +273,5 @@ func checkMetaHeaders(signedHeadersMap http.Header, r *http.Request) APIErrorCod
|
||||
}
|
||||
}
|
||||
|
||||
// check values from url, if no http header
|
||||
for k, val := range r.Form {
|
||||
if stringsHasPrefixFold(k, "x-amz-meta-") {
|
||||
if signedHeadersMap.Get(http.CanonicalHeaderKey(k)) == val[0] {
|
||||
continue
|
||||
}
|
||||
return ErrUnsignedHeaders
|
||||
}
|
||||
}
|
||||
|
||||
return ErrNone
|
||||
}
|
||||
|
@ -394,17 +394,4 @@ func TestCheckMetaHeaders(t *testing.T) {
|
||||
if errCode != ErrNone {
|
||||
t.Fatalf("Expected the APIErrorCode to be %d, but got %d", ErrNone, errCode)
|
||||
}
|
||||
|
||||
// Add extra metadata in url values
|
||||
r, err = http.NewRequest(http.MethodPut, "http://play.min.io:9000?x-amz-meta-test=test&x-amz-meta-extension=png&x-amz-meta-name=imagepng&x-amz-meta-clone=fail", nil)
|
||||
if err != nil {
|
||||
t.Fatal("Unable to create http.Request :", err)
|
||||
}
|
||||
|
||||
r.ParseForm()
|
||||
// calling the function being tested.
|
||||
errCode = checkMetaHeaders(signedHeadersMap, r)
|
||||
if errCode != ErrUnsignedHeaders {
|
||||
t.Fatalf("Expected the APIErrorCode to be %d, but got %d", ErrUnsignedHeaders, errCode)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user