Add a check to see if the X-Amz-Expires header in the presigned URL is less than 7 days. Fixes #5162
Showing the changes to cmd/api-errors.go (1 of 3 files). Show all
Unified · Split
| @@ -120,6 +120,7 @@ const ( · 119 unmodified lines | ||
| 120 | 120 | ErrBucketAlreadyExists |
| 121 | 121 | ErrMetadataTooLarge |
| 122 | 122 | ErrUnsupportedMetadata |
| 123 | + ErrMaximumExpires | |
| 123 | 124 | // Add new error codes here. |
| 124 | 125 | |
| 125 | 126 | // Server-Side-Encryption (with Customer provided key) related API errors. |
| @@ -725,6 +726,11 @@ var errorCodeResponse = map[APIErrorCode]APIError{ · 599 unmodified lines | ||
| 725 | 726 | Description: errObjectTampered.Error(), |
| 726 | 727 | HTTPStatusCode: http.StatusPartialContent, |
| 727 | 728 | }, |
| 729 | + ErrMaximumExpires: { | |
| 730 | + Code: "AuthorizationQueryParametersError", | |
| 731 | + 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", | |
| 732 | + HTTPStatusCode: http.StatusBadRequest, | |
| 733 | + }, | |
| 728 | 734 | // Add your error structure here. |
| 729 | 735 | } |
| 730 | 736 | |