Skip to content

Retry Metric Header included in S3 Presigned URL #2467

Closed
@dstufft

Description

Describe the bug

When creating a Presigned URL for S3, the signed request includes the amz-sdk-request header, which requires the client to pass that header as well. This not only leaks an internal SDK header, but it breaks using the presigned URL as a plain HTTP redirect.

Expected Behavior

The amz-sdk-request header is not included in the Amz-SignedHeaders.

Current Behavior

The amz-sdk-request header is included in the Amz-SignedHeaders, requiring clients to pass amz-sdk-request: attempt=1; max=3 when making the request.

Reproduction Steps

svc := s3.NewPresignClient(s3Client)

var req *v4.PresignedHTTPRequest
req, err := svc.PresignGetObject(ctx,
	&s3.GetObjectInput{
		Bucket: &s3Bucket,
		Key:    &objectKey,
	},
	s3.WithPresignExpires(time.Minute*15),
)


fmt.Printf("%v", req)

Note that the printed output will include the amz-sdk-request header:

&{https://s3.us-east-1.amazonaws.com/bucket/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-SignedHeaders=amz-sdk-request%3Bhost&x-id=GetObject&X-Amz-Signature=xxx GET map[Amz-Sdk-Request:[attempt=1; max=3] Host:[s3.us-east-1.amazonaws.com]]}

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

```
github.com/aws/aws-sdk-go-v2 v1.24.1
github.com/aws/aws-sdk-go-v2/config v1.26.4
github.com/aws/aws-sdk-go-v2/credentials v1.16.15
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.8
github.com/aws/aws-sdk-go-v2/service/s3 v1.48.1
```

Compiler and Version used

go version go1.21.5 darwin/arm64

Operating System and version

macOS 14.2.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

compatibilityIssues with SDK, Go language version, or platform compatibility.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions