aws / aws/aws-sdk-java-v2

The Same File Contents hashes to different ETag for encrypted buckets

Open
#7,082 5 comments 0 reactions 0 assignees View on GitHub
bug service-api service:s3
Dominant language
Java
Stars
2.6k
Forks
1k
Avg merge
2d 9h
Merged PRs (30d)
51

Description

### Describe the bug

As perfectly described by steveloughran in his comment [here](https://github.com/aws/aws-sdk-java-v2/issues/6785#issuecomment-4809259129), single file uploads hash to completely different etags in encrypted buckets even when the file contents are exactly the same.

Since the dawn of S3 (correct?), etags have consistently identified the contents of the same file. This means that as long as the file is the same -- doesn't change -- the file will always have the same etag; and this is completely independent of whether the file is downloaded and then reuploaded to a different path.

However, encrypted buckets have changed this formula, so that the same file uploaded to different paths no longer has the same etag. This is contrary to the definition and purpose of Etags, as I explained [here](https://github.com/aws/aws-sdk-java-v2/issues/6785#issuecomment-4809533876).

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Expected Behavior

When using Encrypted Buckets, just like in Decrypted Buckets, the same file should have the same Etag regardless of whether it's re-uploaded to a different path or not.

### Current Behavior

Already explained above.

### Reproduction Steps

Go to S3 Console, create an encrypted bucket, take a file, upload it to one path, then upload the same file to a different path. Compare the resulting ETags and notice that they're different (even though they're supposed to be the exact same).

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS Java SDK version used

Any

### JDK version used

Any

### Operating System and version

Any

Contributor guide

Open the contributing guide

Research direction

The report provides no repository file, test, or SDK entry point to inspect; begin by determining whether the ETag behavior is controlled by the Java SDK or by S3 encrypted buckets. Reproduce the two uploads described and confirm the expected outcome with maintainers before identifying a repository change.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.