Skip to content

Commit

Permalink
auth: disable uri path escaping for presigned URLs
Browse files Browse the repository at this point in the history
Closes #1046.

Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
  • Loading branch information
smallhive committed Dec 18, 2024
1 parent b0ac82c commit 1b4d0e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This document outlines major changes between releases.
### Added

### Changed
- Disable URI path escaping for presigned URLs (#1046)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion api/auth/center.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ func cloneRequest(r *http.Request, authHeader *authHeader) *http.Request {
func (c *center) checkSign(authHeader *authHeader, box *accessbox.Box, request *http.Request, signatureDateTime time.Time) error {
awsCreds := credentials.NewStaticCredentials(authHeader.AccessKeyID, box.Gate.AccessKey, "")
signer := v4amz.NewSigner(awsCreds)
signer.DisableURIPathEscaping = true

var signature string
if authHeader.IsPresigned {
Expand All @@ -331,7 +332,6 @@ func (c *center) checkSign(authHeader *authHeader, box *accessbox.Box, request *
}
signature = request.URL.Query().Get(AmzSignature)
} else {
signer.DisableURIPathEscaping = true
if _, err := signer.Sign(request, nil, authHeader.Service, authHeader.Region, signatureDateTime); err != nil {
return fmt.Errorf("failed to sign temporary HTTP request: %w", err)
}
Expand Down

0 comments on commit 1b4d0e3

Please sign in to comment.