Skip to content

Support for new HttpChecksum trait for requests and responses #3038

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 2 commits into from
Feb 21, 2022

Conversation

joviegas
Copy link
Contributor

@joviegas joviegas commented Feb 16, 2022

Motivation and Context

This PR will support adding of Http Checksum for request and automatically validating Http Checksum for responses based on the httpChecksum trait defined in the model

    "PutOperationWithChecksum":{
      "name":"PutOperationWithChecksum",
      "http":{
        "method":"PUT",
        "requestUri":"/"
      },
      "input":{"shape":"PutOperationRequest"},
      "output":{"shape":"PutOperationResponse"},
      "httpChecksum" : {
        "requestChecksumRequired": true,
        "requestAlgorithmMember": "ChecksumAlgorithm"
      }
    },
    "GetOperationWithChecksum":{
      "name":"GetOperationWithChecksum",
      "http":{
        "method":"GET",
        "requestUri":"/"
      },
      "input":{"shape":"GetOperationRequest"},
      "output":{"shape":"GetOperationResponse"},
      "httpChecksum" : {
        "requestValidationModeMember": "ChecksumMode",
        "responseAlgorithms": ["CRC32C", "CRC32", "SHA1", "SHA256"]
      }
    },
  • Example
    • For PutOperationWithChecksum as above , http Checksum will be calculated as per the checksum defined in ChecksumAlgorithm field of its input request that is PutOperationRequest in this case.
    • For GetOperationWithChecksum as above, validation is supported for following algorithms ["CRC32C", "CRC32", "SHA1", "SHA256"] and the response is validated based on the ChecksumMode field of the outputResponse that is GetOperationResponse.

Modifications

  • Codegen changes to identify and add required attributes when an operation is maked with httpChecksum traits.
  • Interceptors to add the checksums
  • Signer modification to add Checksum while reading the payload for signing.

Testing

  • Local builds.
  • Integ test as part of this PR checks

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

@joviegas joviegas requested a review from a team as a code owner February 16, 2022 21:15
@joviegas joviegas force-pushed the http_checksum_generic_pr branch 4 times, most recently from c08634c to a7e4fc6 Compare February 17, 2022 07:51
* This class will use the mark() & reset() of the wrapped InputStream if they
* are supported, otherwise it will create a buffer for bytes read from
* the wrapped stream.
*/
@SdkInternalApi
@SdkProtectedApi
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this still be in software.amazon.awssdk.core.internal?

Same feedback for any other classes that were escalated from @SdkInternalApi to @SdkProtectedApi.

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 catch, this class is extended and used only by internal classes, this should be reverted back to @SdkInternalApi
as it was before #2780

@joviegas joviegas force-pushed the http_checksum_generic_pr branch from a7e4fc6 to b640d63 Compare February 18, 2022 06:47
@joviegas joviegas force-pushed the http_checksum_generic_pr branch from b640d63 to cf4f19d Compare February 18, 2022 17:10
@joviegas joviegas force-pushed the http_checksum_generic_pr branch 4 times, most recently from 6f21cd0 to 177a719 Compare February 20, 2022 18:40
@joviegas joviegas force-pushed the http_checksum_generic_pr branch from 177a719 to 3dea384 Compare February 20, 2022 19:20
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 7 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 12 Code Smells

77.4% 77.4% Coverage
1.3% 1.3% Duplication

@joviegas joviegas merged commit 1246c2a into aws:master Feb 21, 2022
aws-sdk-java-automation pushed a commit that referenced this pull request May 17, 2024
Revert japicmp upgrade since Jdk8 release builds were failing which were using aws/codebuild/java:openjdk-8 images
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.

2 participants