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

fix: customization for x-amz-content-sha256 header bindings #1221

Closed
wants to merge 4 commits into from

Conversation

lauzadis
Copy link
Member

If a service has a header binding for x-amz-content-sha256, use that input members' value for the HashSpecification if it's set. This addresses the issue reported in #1217.

Issue #

Closes #1217

Description of changes

This change is required because the Codeartifact services has an HTTP header binding for x-amz-content-sha256, which conflicts with the aws-chunked content encoding specification.

If a user sets the member associated with the header binding, use that value instead of computing it with aws-chunked.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lauzadis lauzadis requested a review from a team as a code owner February 16, 2024 22:07
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

override fun render(ctx: ProtocolGenerator.GenerationContext, op: OperationShape, writer: KotlinWriter) {
val member = getXAmzContentSha256HeaderMember(ctx, op)!!
writer.withBlock("input.${member.defaultName()}?.let {", "}") {
writer.write("op.context[#1T.#2T] = #2T.Precalculated(it)", RuntimeTypes.Auth.Signing.AwsSigningCommon.AwsSigningAttributes, RuntimeTypes.Auth.Signing.AwsSigningCommon.HashSpecification)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: The HashSpecification class is not the same as the HashSpecification property of AwsSigningAttributes so reusing the same symbol is incorrect. For properties, we should just use the literal name in the codegen text:

writer.write(
    "op.context[#T.HashSpecification] = #T.Precalculated(it)",
    RuntimeTypes.Auth.Signing.AwsSigningCommon.AwsSigningAttributes,
    RuntimeTypes.Auth.Signing.AwsSigningCommon.HashSpecification,
)

@lauzadis
Copy link
Member Author

addressed the issue with #1224 instead.

@lauzadis lauzadis closed this Feb 19, 2024
@lauzadis lauzadis deleted the fix-sha256-header-bindings branch February 19, 2024 20:06
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.

CodeArtifact .publishPackageVersion fails for large generic artifact with 'InvalidSignatureException'
2 participants