mirror of
https://github.com/versity/versitygw.git
synced 2026-08-18 21:26:27 +00:00
Fixes #1707 The `Expect` HTTP header is ignored by the AWS SDK SigV4 signer and is omitted during signature calculation. As a result, the signature is computed incorrectly when the `Expect` header is included in the signed headers. This PR removes the `Expect` header from the SigV4 ignored headers list in the SDK-derived source code.
74 lines
3.5 KiB
Go
74 lines
3.5 KiB
Go
package v4
|
|
|
|
// IgnoredHeaders is a list of headers that are ignored during signing
|
|
var IgnoredHeaders = Rules{
|
|
ExcludeList{
|
|
MapRule{
|
|
"Authorization": struct{}{},
|
|
// some clients use user-agent in signed headers
|
|
// "User-Agent": struct{}{},
|
|
"X-Amzn-Trace-Id": struct{}{},
|
|
// Expect might appear in signed headers
|
|
// "Expect": struct{}{},
|
|
},
|
|
},
|
|
}
|
|
|
|
// RequiredSignedHeaders is a allow list for Build canonical headers.
|
|
var RequiredSignedHeaders = Rules{
|
|
AllowList{
|
|
MapRule{
|
|
"Cache-Control": struct{}{},
|
|
"Content-Disposition": struct{}{},
|
|
"Content-Encoding": struct{}{},
|
|
"Content-Language": struct{}{},
|
|
"Content-Md5": struct{}{},
|
|
"Content-Type": struct{}{},
|
|
"Expires": struct{}{},
|
|
"If-Match": struct{}{},
|
|
"If-Modified-Since": struct{}{},
|
|
"If-None-Match": struct{}{},
|
|
"If-Unmodified-Since": struct{}{},
|
|
"Range": struct{}{},
|
|
"X-Amz-Acl": struct{}{},
|
|
"X-Amz-Copy-Source": struct{}{},
|
|
"X-Amz-Copy-Source-If-Match": struct{}{},
|
|
"X-Amz-Copy-Source-If-Modified-Since": struct{}{},
|
|
"X-Amz-Copy-Source-If-None-Match": struct{}{},
|
|
"X-Amz-Copy-Source-If-Unmodified-Since": struct{}{},
|
|
"X-Amz-Copy-Source-Range": struct{}{},
|
|
"X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{},
|
|
"X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{},
|
|
"X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{},
|
|
"X-Amz-Expected-Bucket-Owner": struct{}{},
|
|
"X-Amz-Grant-Full-control": struct{}{},
|
|
"X-Amz-Grant-Read": struct{}{},
|
|
"X-Amz-Grant-Read-Acp": struct{}{},
|
|
"X-Amz-Grant-Write": struct{}{},
|
|
"X-Amz-Grant-Write-Acp": struct{}{},
|
|
"X-Amz-Metadata-Directive": struct{}{},
|
|
"X-Amz-Mfa": struct{}{},
|
|
"X-Amz-Request-Payer": struct{}{},
|
|
"X-Amz-Server-Side-Encryption": struct{}{},
|
|
"X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{},
|
|
"X-Amz-Server-Side-Encryption-Context": struct{}{},
|
|
"X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{},
|
|
"X-Amz-Server-Side-Encryption-Customer-Key": struct{}{},
|
|
"X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{},
|
|
"X-Amz-Storage-Class": struct{}{},
|
|
"X-Amz-Website-Redirect-Location": struct{}{},
|
|
"X-Amz-Content-Sha256": struct{}{},
|
|
"X-Amz-Tagging": struct{}{},
|
|
},
|
|
},
|
|
Patterns{"X-Amz-Object-Lock-"},
|
|
Patterns{"X-Amz-Meta-"},
|
|
}
|
|
|
|
// AllowedQueryHoisting is a allowed list for Build query headers. The boolean value
|
|
// represents whether or not it is a pattern.
|
|
var AllowedQueryHoisting = InclusiveRules{
|
|
ExcludeList{RequiredSignedHeaders},
|
|
Patterns{"X-Amz-"},
|
|
}
|