mirror of
https://github.com/minio/minio.git
synced 2025-03-12 20:50:11 -04:00
Verify both 'x-amz-date' and 'date' header before discarding request
This commit is contained in:
parent
62648c8636
commit
8087ca2450
@ -34,9 +34,12 @@ func SignRequest(user config.User, req *http.Request) {
|
||||
|
||||
// This package implements verification side of Object API Signature request
|
||||
func ValidateRequest(user config.User, req *http.Request) (bool, error) {
|
||||
if date := req.Header.Get("Date"); date == "" {
|
||||
// Verify if date headers are set, if not reject the request
|
||||
if req.Header.Get("x-amz-date") == "" {
|
||||
if req.Header.Get("Date") == "" {
|
||||
return false, fmt.Errorf("Date should be set")
|
||||
}
|
||||
}
|
||||
hm := hmac.New(sha1.New, []byte(user.SecretKey))
|
||||
ss := getStringToSign(req)
|
||||
io.WriteString(hm, ss)
|
||||
|
Loading…
x
Reference in New Issue
Block a user