Skip to content

Commit

Permalink
fix s3 requests sent to outpost arn missing x-amz-content-sha256 head…
Browse files Browse the repository at this point in the history
…er (#4857)
  • Loading branch information
aajtodd authored May 25, 2023
1 parent b6ba82b commit 502bd69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
### SDK Enhancements

### SDK Bugs

* `service/s3`: Populate X-Amz-Content-Sha256 header when using s3 outpost arn
* Using an outpost ARN results in a different signing name from the resolved endpoint. This signing name was not included in the signer logic to indicate the `X-Amz-Content-Sha256` header should be added to the request which is required by S3.
11 changes: 6 additions & 5 deletions aws/signer/v4/v4.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Provides request signing for request that need to be signed with
// AWS V4 Signatures.
//
// Standalone Signer
// # Standalone Signer
//
// Generally using the signer outside of the SDK should not require any additional
// logic when using Go v1.5 or higher. The signer does this by taking advantage
Expand All @@ -14,10 +14,10 @@
// The signer will first check the URL.Opaque field, and use its value if set.
// The signer does require the URL.Opaque field to be set in the form of:
//
// "//<hostname>/<path>"
// "//<hostname>/<path>"
//
// // e.g.
// "//example.com/some/path"
// // e.g.
// "//example.com/some/path"
//
// The leading "//" and hostname are required or the URL.Opaque escaping will
// not work correctly.
Expand Down Expand Up @@ -695,7 +695,8 @@ func (ctx *signingCtx) buildBodyDigest() error {
includeSHA256Header := ctx.unsignedPayload ||
ctx.ServiceName == "s3" ||
ctx.ServiceName == "s3-object-lambda" ||
ctx.ServiceName == "glacier"
ctx.ServiceName == "glacier" ||
ctx.ServiceName == "s3-outposts"

s3Presign := ctx.isPresign &&
(ctx.ServiceName == "s3" ||
Expand Down

0 comments on commit 502bd69

Please sign in to comment.