smithy-lang / smithy-kotlin

Smithy code generator for Kotlin (in development)
Apache License 2.0
72 stars 26 forks source link

Signing issue when pre-computed hash provided in x-amz-content-sha256 #1037

Closed cloudshiftchris closed 4 months ago

cloudshiftchris commented 4 months ago

Describe the bug

Details are in Kotlin SDK ticket.

tl;dr: for CodeArtifact.PublishPackageVersion the pre-computed hash is used in the header but aws-chunked encoding is also activated - the two are incompatible.

Results in invalid signature exceptions.

The issue may occur for any other API call that explicitly sets x-amz-content-sha256.

Expected Behavior

Signatures are calculated correctly / request headers are correctly populated; uploading CodeArtifact assets via PublishPackageVersion does not receive an invalid signature exception.

Current Behavior

Invalid signature exception received from CodeArtifact service (details in linked ticket)

Steps to Reproduce

Repro steps in linked ticket. tl;dr: call CodeArtifact.PublishPackageVersion for a generic artifact of sufficient size to be chunked (>16k).

Possible Solution

Details in linked ticket. tl;dr: adjust signing logic to use pre-computed hash / bypass auto-detection of chunked encoding.

Context

Unable to use CodeArtifact.PublishPackageVersion from Kotlin SDK for assets > 16k.

Your Environment

AWS Kotlin SDK 1.0.57 Java 17 MacOS Sonoma