Open skand888 opened 3 months ago
Hello @skand888,
Thank you for reporting the issue. The above S3 Exception - The SHA256 you specified did not match the calculated checksum.
is reproducible over non-secure (http) S3 endpoint in Java SDK version 2.21.16
and above.
S3Client s3Client = S3Client.builder()
.endpointOverride(URI.create("http://s3.us-east-1.amazonaws.com"))
.build();
var req = PutObjectRequest.builder()
.bucket("bucketname")
.key("objectname")
.checksumAlgorithm(ChecksumAlgorithm.SHA256)
.build();
Path path = Paths.get("/Users/**/test.txt");
var resp = s3Client.putObject(req, path);
We will investigate further on this.
Regards, Chaitanya
@bhoradc has this issue been prioritized for any future releases? Having the same issue
Hi @bekzod-alibayev,
Thank you for reporting the issue. It's generally recommended to use HTTPS for communication with AWS services due to the security benefits it provides.
I am working with the team to see how we can reprioritize this issue. Meanwhile, could you please provide more details on your specific use case and reasons for preferring to use HTTP over HTTPS?
Regards, Chaitanya
Hi @bekzod-alibayev,
Thank you for reporting the issue. It's generally recommended to use HTTPS for communication with AWS services due to the security benefits it provides.
I am working with the team to see how we can reprioritize this issue. Meanwhile, could you please provide more details on your specific use case and reasons for preferring to use HTTP over HTTPS?
Regards, Chaitanya
We have Envoy sidecar container and all of the external traffic goes through it. In order to hit envoy container, it has to be http and envoy will do ssl for all external requests.
Hi @bekzod-alibayev,
Thank you for providing the use-case. Our team is working on prioritization of this issue and will get back to you when we have further updates on it.
Regards, Chaitanya
Describe the bug
When we specify
ChecksumAlgorithm.SHA256
, it's expected that the SDK will calculate the checksum and include it to the request.However, the following code results in
software.amazon.awssdk.services.s3.model.S3Exception: The provided 'x-amz-content-sha256' header does not match what was computed. (Service: S3, Status Code: 400, ...)
It works as expected and completes sucsefully over HTTPS.
The entire request captured with Wireshark:
Actual file SHA256 is different from either SHA256 value:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
is SHA256 of an empty zero-size file,SMxWlcQBWBPkquqaEFUHaNZMNHb59jFjJ5p1DQueB7c=
is checksum of something else.Expected Behavior
The code successfully uploads object via both HTTP and HTTPS.
Current Behavior
HTTPS: success HTTP:
software.amazon.awssdk.services.s3.model.S3Exception: The provided 'x-amz-content-sha256' header does not match what was computed. (Service: S3, Status Code: 400, ...)
Other checksum algorithms work fine.
Reproduction Steps
Over HTTP endpoint URL:
Possible Solution
Properly calculate value for
x-amz-checksum-sha256
even whenx-amz-content-sha256
is used in signing process.Additional Information/Context
No response
AWS Java SDK version used
2.26.29
JDK version used
21
Operating System and version
Linux