mirror of
https://github.com/pgsty/minio.git
synced 2026-07-23 14:10:25 +03:00
Check for value > 7 days in X-Amz-Expires header. (#5163)
Add a check to see if the X-Amz-Expires header in the presigned URL is less than 7 days. Fixes #5162
This commit is contained in:
@@ -750,6 +750,30 @@ func TestParsePreSignV4(t *testing.T) {
|
||||
},
|
||||
expectedErrCode: ErrNone,
|
||||
},
|
||||
|
||||
// Test case - 9.
|
||||
// Test case with value greater than 604800 in X-Amz-Expires header.
|
||||
{
|
||||
inputQueryKeyVals: []string{
|
||||
// valid "X-Amz-Algorithm" header.
|
||||
"X-Amz-Algorithm", signV4Algorithm,
|
||||
// valid "X-Amz-Credential" header.
|
||||
"X-Amz-Credential", joinWithSlash(
|
||||
"Z7IXGOO6BZ0REAN1Q26I",
|
||||
sampleTimeStr,
|
||||
"us-west-1",
|
||||
"s3",
|
||||
"aws4_request"),
|
||||
// valid "X-Amz-Date" query.
|
||||
"X-Amz-Date", queryTime.UTC().Format(iso8601Format),
|
||||
// Invalid Expiry time greater than 7 days (604800 in seconds).
|
||||
"X-Amz-Expires", getDurationStr(605000),
|
||||
"X-Amz-Signature", "abcd",
|
||||
"X-Amz-SignedHeaders", "host;x-amz-content-sha256;x-amz-date",
|
||||
},
|
||||
expectedPreSignValues: preSignValues{},
|
||||
expectedErrCode: ErrMaximumExpires,
|
||||
},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user