Skip to content

[reverted] Make it possible to disable integrity checks for multipart uploads #3148

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

Merged
merged 1 commit into from
Jul 22, 2025

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented Jul 21, 2025

As announced in #2960, AWS SDK for Go v2 service/s3 v1.73.0 shipped a change (#2808) that adopted the new default integrity protections.

While it is possible to revert to the previous behavior by setting AWS_REQUEST_CHECKSUM_CALCULATION=when_required, this config setting did not apply to the S3 Manager multipart uploader, which always enabled CRC32 checksums by default.

This commit checks the S3 options and only attaches the CRC32 checksums if when_required is not set.

Relates to #3007

@stanhu stanhu force-pushed the sh-fix-issue-3007-checksums branch from 4d2ab95 to 8932ea0 Compare July 21, 2025 18:23
@wty-Bryant
Copy link
Contributor

wty-Bryant commented Jul 21, 2025

@stanhu LGTM, could you rebase it from latest release today so I can approve

@stanhu stanhu force-pushed the sh-fix-issue-3007-checksums branch from 8932ea0 to 1c0245e Compare July 21, 2025 20:20
@stanhu
Copy link
Contributor Author

stanhu commented Jul 21, 2025

@wty-Bryant Done, thanks!

@wty-Bryant
Copy link
Contributor

codegen/integration test failed in forks, waiting for other CI pass and merge

@stanhu stanhu force-pushed the sh-fix-issue-3007-checksums branch 3 times, most recently from 3f4a6e0 to 49a9057 Compare July 21, 2025 20:51
As announced in aws#2960,
AWS SDK for Go v2 service/s3 v1.73.0 shipped a change
(aws#2808) that adopted the new
default integrity protections.

While it is possible to revert to the previous behavior by setting
`AWS_REQUEST_CHECKSUM_CALCULATION=when_required`, this config setting
did not apply to the S3 Manager multipart uploader, which always enabled
CRC32 checksums by default.

This commit checks the S3 options and only attaches the CRC32 checksums
if `when_required` is not set.

Relates to aws#3007

Signed-off-by: Stan Hu <[email protected]>
@stanhu stanhu force-pushed the sh-fix-issue-3007-checksums branch from 49a9057 to 1f72db5 Compare July 21, 2025 21:15
@wty-Bryant wty-Bryant merged commit 17d8d81 into aws:main Jul 22, 2025
11 of 13 checks passed
lucix-aws added a commit that referenced this pull request Jul 22, 2025
@lucix-aws
Copy link
Contributor

@wty-Bryant Please discuss external contributor PRs with at least one other team member before merging them.

@lucix-aws lucix-aws changed the title Make it possible to disable integrity checks for multipart uploads [reverted] Make it possible to disable integrity checks for multipart uploads Jul 22, 2025
@lucix-aws
Copy link
Contributor

lucix-aws commented Jul 22, 2025

@stanhu I've reverted this as the patch was not properly reviewed by multiple team members prior to merging. We are willing to accept a contribution for this-- but a minimum you would need to change this to expose the checksum calculation setting on the uploader's options structure rather than inferring it from the provided S3 client.

You will also need to ensure that this does not break S3 Express buckets, which require CRC32 in all scenarios.

stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 25, 2025
… default checksums (aws#3148)

As announced in aws#2960,
AWS SDK for Go v2 service/s3 v1.73.0 shipped a change
(aws#2808) that adopted new
default integrity protections, automatically calculating CRC32 checksums
for operations like PutObject and UploadPart.

While it is possible to revert to the previous behavior by setting
`AWS_REQUEST_CHECKSUM_CALCULATION=when_required`, this config setting
did not apply to the S3 Manager multipart uploader, which always enabled
CRC32 checksums by default regardless of the global setting.

This commit adds a new `RequestChecksumCalculation` field to the Uploader
struct that allows users to control checksum behavior:

- `RequestChecksumCalculationWhenSupported` (default): Always calculates
  CRC32 checksums for multipart uploads
- `RequestChecksumCalculationWhenRequired`: Only calculates checksums
  when explicitly set by the user, preserving backwards compatibility

For example:

```go
uploader := manager.NewUploader(client, func(u *manager.Uploader) {
    u.RequestChecksumCalculation = aws.RequestChecksumCalculationWhenRequired
})
```

S3 Express One Zone buckets always require CRC32 checksums regardless of
this setting, as mandated by the S3 Express service requirements.  The
uploader automatically detects S3 Express buckets (names ending with
`--x-s3`) and applies CRC32 checksums unconditionally.

Fixes aws#3007
@stanhu
Copy link
Contributor Author

stanhu commented Jul 25, 2025

@lucix-aws @wty-Bryant Ok. Can you review #3151?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants