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

User supplied flexible checksums not respected #1122

Closed
aajtodd opened this issue Apr 4, 2024 · 3 comments
Closed

User supplied flexible checksums not respected #1122

aajtodd opened this issue Apr 4, 2024 · 3 comments
Labels
bug This issue is a bug. duplicate This issue is a duplicate. p2 This is a standard priority issue

Comments

@aajtodd
Copy link
Contributor

aajtodd commented Apr 4, 2024

Describe the bug

When a user supplies both checksum_algorithm and a pre-calculated checksum the SDK will go ahead and calculate one anyway and overwrite the user supplied one.

s3.put_object()
    .bucket(bucket_name)
    .key(key_name)
    .checksum_algorithm(aws_sdk_s3::types::ChecksumAlgorithm::Sha256)
    .checksum_sha256("bad-sha")
    .body(body)
    .send()
    .await?;

Expected Behavior

The SDK should detect this and use the user supplied value and do nothing. This is the behavior described in the SEP.

Current Behavior

The user supplied checksum is serialized to a header and then is later overwritten with the value it calculates.

Reproduction Steps

See bug description. Sending a bad value for the checksum should fail but it doesn't because we overwrite it.

Possible Solution

No response

Additional Information/Context

No response

Version

aws-sdk-s3 = "1.21.0"

Environment details (OS name and version, etc.)

macOS 14.4

Logs

No response

@aajtodd aajtodd added bug This issue is a bug. p2 This is a standard priority issue labels Apr 4, 2024
@CNorskov
Copy link

CNorskov commented Apr 5, 2024

Same problem here (with a working solution):
#1103 (comment)

In short:
A workaround is not specifying the algorithm. So a working code would be:

s3.put_object()
    .bucket(bucket_name)
    .key(key_name)
    .checksum_sha256("bad-sha")
    .body(body)
    .send()
    .await?;

@aajtodd aajtodd added the duplicate This issue is a duplicate. label Apr 5, 2024
@aajtodd
Copy link
Contributor Author

aajtodd commented Apr 5, 2024

closing as duplicate of #1103

@aajtodd aajtodd closed this as completed Apr 5, 2024
Copy link

github-actions bot commented Apr 5, 2024

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. duplicate This issue is a duplicate. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants