Description
Pre-Migration Checklist
- I've read the Migration Guide.
- I've checked AWS Forums and StackOverflow for similar migration issues.
Go Version Used
go 1.22
Describe the Migration Issue
In the s3 package github.com/aws/aws-sdk-go-v2/service/s3
the input to the SSECustomerKey
field in s3.HeadObjectInput
, s3.CopyObjectInput
, s3.GetObjectInput
and s3.PutObjectInput
(there may be others but I tested those ones) needs to base64 encoded, whereas in the v1 SDK it did not.
This is not mentioned in the docs, eg
aws-sdk-go-v2/service/s3/api_op_GetObject.go
Lines 340 to 361 in 5f159bb
And it is not mentioned in the Migration Guide
So I can only assume it is either a bug or an undocumented change.
Code Comparison
No response
Observed Differences/Errors
SDKv1 sends this (note the X-Amz-Server-Side-Encryption-Customer-Key
here is a test key so not sensitive)
2024/08/07 09:56:52 DEBUG : HEAD /README.md HTTP/1.1
Host: rclone-sse-c.s3.eu-west-2.amazonaws.com
User-Agent: rclone/v1.67.0
Authorization: XXXX
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20240807T085652Z
X-Amz-Server-Side-Encryption-Customer-Algorithm: AES256
X-Amz-Server-Side-Encryption-Customer-Key: Y3puOHFyYlVzVC81eTVIcjJpOTNJbVdtSVFMQ1pMT0w=
X-Amz-Server-Side-Encryption-Customer-Key-Md5: ME4ss65LcXQBY2CynVdZyA==
whereas SDKv2 sends this
2024/08/07 09:55:35 DEBUG : HEAD /README.md HTTP/1.1
Host: rclone-sse-c.s3.eu-west-2.amazonaws.com
User-Agent: rclone/v1.68.0-beta.8139.5727beb2b.fix-4989-s3-aws-sdk-v2
Accept-Encoding: identity
Amz-Sdk-Invocation-Id: fe5db3e3-e062-4fa9-9b6e-ab485fb7f99e
Amz-Sdk-Request: attempt=1; max=10
Authorization: XXXX
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20240807T085535Z
X-Amz-Server-Side-Encryption-Customer-Algorithm: AES256
X-Amz-Server-Side-Encryption-Customer-Key: czn8qrbUsT/5y5Hr2i93ImWmIQLCZLOL
X-Amz-Server-Side-Encryption-Customer-Key-Md5: ME4ss65LcXQBY2CynVdZyA==
Which produces this error
operation error S3: HeadObject, https response error StatusCode: 400, RequestID: HBZC24PYAY1HMHBZ, HostID: tDJl5G2Gad6ga16/FB7AG90D5xbSM5LnzFh6/ppUpacGVFLFX6Svs6IEgFDUq8YfsktQ3XhwJMhPAklOoRjQMQ==, api error BadRequest: Bad Request
You can see quite clearly that the X-Amz-Server-Side-Encryption-Customer-Key
in the SDKv1 is a base64 encoded version of that sent by the SDKv2
Additional Context
No response