Skip to content

feat: flexible checksum updates#2808

Merged
wty-Bryant merged 43 commits intomainfrom
feat-flex-checksum
Jan 14, 2025
Merged

feat: flexible checksum updates#2808
wty-Bryant merged 43 commits intomainfrom
feat-flex-checksum

Conversation

@wty-Bryant
Copy link
Copy Markdown
Contributor

Add client cfg to opt-in/out checksum calculation/validation, change default algorithm to calculate checksum

@wty-Bryant wty-Bryant requested a review from a team as a code owner September 26, 2024 03:33

// ID provides the middleware identifier
func (m *RequestChecksumMetricsTracking) ID() string {
return "AWSChecksum:RequestMetricsTracking"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[observation] we don't follow this pattern of x:yon other middlewares, but I like how you used it here

@lucix-aws lucix-aws changed the title [DO NOT MERGE] Feat flex checksum feat: flexible checksum updates Jan 14, 2025
{
"id": "9ebe24c4-7915-41e0-840d-a49eab6f9d97",
"type": "feature",
"description": "S3 client behavior is updated to always calculate a checksum by default for operations that support it (such as PutObject or UploadPart), or require it (such as DeleteObjects). The checksum algorithm used by default now becomes CRC32. Checksum behavior can be configured using `when_supported` and `when_required` options - in code using RequestChecksumCalculation, in shared config using request_checksum_calculation, or as env variable using AWS_REQUEST_CHECKSUM_CALCULATION. The S3 client attempts to validate response checksums for all S3 API operations that support checksums. However, if the SDK has not implemented the specified checksum algorithm then this validation is skipped. Checksum validation behavior can be configured using `when_supported` and `when_required` options - in code using ResponseChecksumValidation, in shared config using response_checksum_validation, or as env variable using AWS_RESPONSE_CHECKSUM_VALIDATION.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "S3 client behavior is updated to always calculate a checksum by default for operations that support it (such as PutObject or UploadPart), or require it (such as DeleteObjects). The checksum algorithm used by default now becomes CRC32. Checksum behavior can be configured using `when_supported` and `when_required` options - in code using RequestChecksumCalculation, in shared config using request_checksum_calculation, or as env variable using AWS_REQUEST_CHECKSUM_CALCULATION. The S3 client attempts to validate response checksums for all S3 API operations that support checksums. However, if the SDK has not implemented the specified checksum algorithm then this validation is skipped. Checksum validation behavior can be configured using `when_supported` and `when_required` options - in code using ResponseChecksumValidation, in shared config using response_checksum_validation, or as env variable using AWS_RESPONSE_CHECKSUM_VALIDATION.",
"description": "S3 client behavior is updated to always calculate a checksum by default for operations that support it (such as PutObject or UploadPart), or require it (such as DeleteObjects). The checksum algorithm used by default now becomes CRC32. Checksum behavior can be configured using `when_supported` and `when_required` options in 3 different places - in code using RequestChecksumCalculation, in shared config using request_checksum_calculation, or as env variable using AWS_REQUEST_CHECKSUM_CALCULATION. The S3 client attempts to validate response checksums for all S3 API operations that support checksums. However, if a different checksum algorithm is specified and the SDK has not yet implemented it, this validation is skipped. Checksum validation behavior can be configured using `when_supported` and `when_required` options in 3 places as well - in code using ResponseChecksumValidation, in shared config using response_checksum_validation, or as env variable using AWS_RESPONSE_CHECKSUM_VALIDATION.",

@wty-Bryant wty-Bryant merged commit 6636822 into main Jan 14, 2025
@wty-Bryant wty-Bryant deleted the feat-flex-checksum branch January 14, 2025 22:15
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 21, 2025
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
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 21, 2025
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 <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 21, 2025
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 <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 21, 2025
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 <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 21, 2025
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 <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 21, 2025
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 <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 21, 2025
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 <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 21, 2025
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 <stanhu@gmail.com>
wty-Bryant pushed a commit that referenced this pull request Jul 22, 2025
…3148)

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

Signed-off-by: Stan Hu <stanhu@gmail.com>
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 added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 25, 2025
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 added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 25, 2025
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

Signed-off-by: Stan Hu <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Jul 25, 2025
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

Signed-off-by: Stan Hu <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Aug 8, 2025
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

Signed-off-by: Stan Hu <stanhu@gmail.com>
stanhu added a commit to stanhu/aws-sdk-go-v2 that referenced this pull request Aug 8, 2025
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

Signed-off-by: Stan Hu <stanhu@gmail.com>
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