Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix s3 requests sent to outpost arn missing x-amz-content-sha256 header #4857

Merged
merged 1 commit into from
May 25, 2023

Conversation

aajtodd
Copy link
Contributor

@aajtodd aajtodd commented May 24, 2023

Example code of testing an outpost endpoint. NOTE: You don't actually have to have an outpost endpoint setup, just plugin your own account and a dummy value for the access point (e.g. my-test-access-point).

package main

import (
    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/aws/session"
    "github.com/aws/aws-sdk-go/service/s3"
    "fmt"
)

func main() {
    sess, err := session.NewSession(&aws.Config{
        Region: aws.String("us-east-1"),
        LogLevel: aws.LogLevel(aws.LogDebugWithHTTPBody),
   },)

    svc := s3.New(sess)
    bucket := "arn:aws:s3-outposts:us-east-1:<account>:outpost/ec2/accesspoint/<my-access-point>"
    resp, err := svc.ListObjectsV2(&s3.ListObjectsV2Input{Bucket: aws.String(bucket)})
    fmt.Printf(" response %v error %v \n", resp, err)
}

output contains

Missing required header for this request: x-amz-content-sha256

The resolved endpoint is an outpost ARN which customizes the signing name to be s3-outposts instead of s3. Requests to S3 must include the x-amz-content-sha256 header but the the v4 signer does not special case s3-outposts to include the header.

This change does affect the actual s3outpost service requests as it shares the same signing name. I've tested that requests with and without the header have the same responses and that it's valid and safe to send this for s3outposts as well.

Go v2 doesn't have this issue since middleware is registered on the operation to add this particular header for S3 requests.

@aajtodd aajtodd merged commit 502bd69 into main May 25, 2023
31 checks passed
@aajtodd aajtodd deleted the fix-V907590371 branch May 25, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants