Skip to content

Conversation

dagnir
Copy link
Contributor

@dagnir dagnir commented Sep 9, 2025

Motivation and Context

This commit adds the ability to reuse previously computed checksums for a request across retries.

This ensures that if a request data stream is modified between attempts that the server will reject the request.

As part of this change, the http-auth-spi package has been updated to expose a new interface: PayloadChecksumStore. This is a simple storage interface that allows signers to store and retrieve computed checksums. Additionally, a new SignerProperty is introduced, SdkInternalHttpSignerProperty.CHECKSUM_CACHE so that signers and their callers can access this cache.

Note that both the interface and associated signer property are @SdkProtectedApi and not intended to be used by non-SDK consumers of http-auth-spi.

Finally, this adds a dependency on checksums-spi for http-auth-spi.

Note: this PR only adds support in the sync codepath. Will follow up with async (merging to a feature branch).

Modifications

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@dagnir dagnir force-pushed the dongie/immutable-checksum branch 7 times, most recently from 731a921 to 344a525 Compare September 10, 2025 21:56
@dagnir dagnir marked this pull request as ready for review September 10, 2025 21:57
@dagnir dagnir requested a review from a team as a code owner September 10, 2025 21:57
@dagnir dagnir force-pushed the dongie/immutable-checksum branch from 344a525 to 1754544 Compare September 10, 2025 21:59
This commit adds the ability to reuse previously computed checksums for
a request across retries.

This ensures that if a request data stream is modified between attempts
that the server will reject the request.

As part of this change, the `http-auth-spi` package has been updated to
expose a new interface: `PayloadChecksumStore`. This is a simple storage
interface that allows signers to store and retrieve computed checksums.
Additionally, a new `SignerProperty` is introduced,
`SdkInternalHttpSignerProperty.CHECKSUM_CACHE` so that signers and
their callers can access this cache.

Note that both the interface and associated signer property are
`@SdkProtectedApi` and not intended to be used by non-SDK consumers of
`http-auth-spi`.

Finally, this adds a dependency on `checksums-spi` for `http-auth-spi`.
@dagnir dagnir force-pushed the dongie/immutable-checksum branch from 1754544 to 2412e29 Compare September 10, 2025 22:01
…al/http/pipeline/stages/SigningStage.java

Co-authored-by: David Ho <[email protected]>
*/
@SdkInternalApi
@SuppressWarnings("deprecation")
public class LegacyPayloadChecksumCache {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to add cache for legacy path, i.e., customers using legacy custom signers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good callout. Actually nothing is using this class for now. I will follow up with another PR for legacy.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
55.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@dagnir dagnir merged commit 8915ee7 into feature/master/checksum-reuse Sep 19, 2025
38 of 40 checks passed
Copy link

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants