You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement an AWS SDK v2 HTTP request Signer for the OpenSearch Go client library (traditionally support was only for AWS SDK V1 signer).
I've discovered that when having a request with a Content-Length already set, the AWS SDK V2 SignerV4 (package: github.com/aws/aws-sdk-go-v2/aws/signer/v4) will incorrectly re-append the content length to the canonical request as comma separated values.
And calling the V1 signer and V2 signer on such a http.Request, will result in different signatures being generated, due to the canonical request being altered erroneously by the V2 implementation.
…1743)
Fixes the SDK's AWS SigV4 signer to not double sign the content-length header. If the Content-Length header was manually set on the http.Request, that value would be included along with the Request.ContentLength value as a common separated list when computing the string to sign.
This fix updates the signer to always ignore the content-length header, and only use the Request.ContentLength parameter. This change also matches http.Request's behavior of ignoring the Content-Length header if set.
Fixes#1728
Replaces: #1729
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
Hi,
I am trying to implement an AWS SDK v2 HTTP request Signer for the OpenSearch Go client library (traditionally support was only for AWS SDK V1 signer).
I've discovered that when having a request with a Content-Length already set, the AWS SDK V2 SignerV4 (package: github.com/aws/aws-sdk-go-v2/aws/signer/v4) will incorrectly re-append the content length to the canonical request as comma separated values.
Having the following test:
And calling the V1 signer and V2 signer on such a http.Request, will result in different signatures being generated, due to the canonical request being altered erroneously by the V2 implementation.
Expected canonical string:
Actual canonical string (note content-length header):
Expected Behavior
Don't reappend the ContentLength as comma separated values.
Current Behavior
ContentLength header value gets appended as comma separated value.
Reproduction Steps
Please see issue description.
Possible Solution
#1729
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
github.com/aws/aws-sdk-go-v2 v1.16.5
github.com/aws/aws-sdk-go-v2/config v1.15.10
Compiler and Version used
go version go1.18.3 darwin/arm64
Operating System and version
MacOs, M1 Pro
The text was updated successfully, but these errors were encountered: