From 6b109eee92e8b7bb00d9071de8d91939a39b609e Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 8 Aug 2023 09:17:35 +0300 Subject: [PATCH] [#182] Fix parsing signed headers in presigned urls Signed-off-by: Denis Kirillov --- CHANGELOG.md | 1 + api/auth/center.go | 2 +- api/auth/presign.go | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 074acb71..7dacb465 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This document outlines major changes between releases. - Return appropriate 404 code when object missed in storage but there is in gate cache (#158) - Replace part on re-upload when use multipart upload (#176) - Fix goroutine leak on put object error (#178) +- Fix parsing signed headers in presigned urls (#182) ### Added - Support dump metrics descriptions (#80) diff --git a/api/auth/center.go b/api/auth/center.go index 0d4cc590..76a9c44c 100644 --- a/api/auth/center.go +++ b/api/auth/center.go @@ -153,7 +153,7 @@ func (c *center) Authenticate(r *http.Request) (*Box, error) { Service: creds[3], Region: creds[2], SignatureV4: queryValues.Get(AmzSignature), - SignedFields: queryValues[AmzSignedHeaders], + SignedFields: strings.Split(queryValues.Get(AmzSignedHeaders), ";"), Date: creds[1], IsPresigned: true, } diff --git a/api/auth/presign.go b/api/auth/presign.go index 755ada99..ea34ba15 100644 --- a/api/auth/presign.go +++ b/api/auth/presign.go @@ -34,6 +34,7 @@ func PresignRequest(creds *credentials.Credentials, reqData RequestData, presign } req.Header.Set(AmzDate, presignData.SignTime.Format("20060102T150405Z")) + req.Header.Set(ContentTypeHdr, "text/plain") signer := v4.NewSigner(creds) signer.DisableURIPathEscaping = true