diff --git a/.changelog/f63b26b19e2e4330b4240f38088453ea.json b/.changelog/f63b26b19e2e4330b4240f38088453ea.json index 24318e02648..ef398bf401e 100644 --- a/.changelog/f63b26b19e2e4330b4240f38088453ea.json +++ b/.changelog/f63b26b19e2e4330b4240f38088453ea.json @@ -1,7 +1,7 @@ { "id": "f63b26b1-9e2e-4330-b424-0f38088453ea", "type": "bugfix", - "description": "Adding logic to omit whitespaces in the signature, and test coverage", + "description": "Improve handling of whitespace (or lack thereof) in sigv4 GetSignedRequestSignature.", "modules": [ "." ] diff --git a/aws/signer/v4/middleware.go b/aws/signer/v4/middleware.go index ed24eaf530e..8a46220a37b 100644 --- a/aws/signer/v4/middleware.go +++ b/aws/signer/v4/middleware.go @@ -374,7 +374,7 @@ func GetSignedRequestSignature(r *http.Request) ([]byte, error) { if auth := r.Header.Get(authorizationHeader); len(auth) != 0 { ps := strings.Split(auth, ",") for _, p := range ps { - p = strings.Trim(p, " ") + p = strings.TrimSpace(p) if idx := strings.Index(p, authHeaderSignatureElem); idx >= 0 { sig := p[len(authHeaderSignatureElem):] if len(sig) == 0 {