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:
kannappanr
2017-11-13 12:54:03 -08:00
committed by Dee Koder
parent d10679866c
commit f460eceb6d
3 changed files with 35 additions and 0 deletions

View File

@@ -120,6 +120,7 @@ const (
ErrBucketAlreadyExists
ErrMetadataTooLarge
ErrUnsupportedMetadata
ErrMaximumExpires
// Add new error codes here.
// Server-Side-Encryption (with Customer provided key) related API errors.
@@ -725,6 +726,11 @@ var errorCodeResponse = map[APIErrorCode]APIError{
Description: errObjectTampered.Error(),
HTTPStatusCode: http.StatusPartialContent,
},
ErrMaximumExpires: {
Code: "AuthorizationQueryParametersError",
Description: "X-Amz-Expires must be less than a week (in seconds); that is, the given X-Amz-Expires must be less than 604800 seconds",
HTTPStatusCode: http.StatusBadRequest,
},
// Add your error structure here.
}