okigan / awscurl

curl-like access to AWS resources with AWS Signature Version 4 request signing.
MIT License
755 stars 94 forks source link

v0.34 - The request signature we calculated does not match the signature you provided error #206

Closed skibak closed 1 month ago

skibak commented 1 month ago

I'm getting error when using release v0.34. "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."

When I downgraded to v0.33, code started to work without issues.

I'm using in python like

        payload = json.dumps({
            <redacted>
        })
        session = boto3.Session()
        creds = session.get_credentials()
        response = awscurl.make_request(
            method='POST',
            service='<redacted>',
            region=self.region,
            uri=self.uri + <redacted>,
            headers={
                "Content-Type": "application/json; charset=UTF-8",
                "Connection": "keep-alive",
                "Content-Encoding": "amz-1.0",
                "x-amz-requestsupertrace": "true"
            },
            data=payload,
            data_binary=False,
            access_key=creds.access_key,
            secret_key=creds.secret_key,
            security_token=creds.token
        )
        return (json.loads(response.text), response)
okigan commented 1 month ago

Seems to be introduced in Include user-specified signed headers (https://github.com/okigan/awscurl/pull/200) https://github.com/okigan/awscurl/commit/22cebb05f1a1bf6280933db30943a1ca54cab1b9

and the above code has "x-amz-requestsupertrace" header

@MegaWattSec

okigan commented 1 month ago

@skibak try latest v0.35 build -- let us know if that resolved the issue

okigan commented 1 month ago

@skibak kind nudge for the above

skibak commented 1 month ago

I checked release 0.35 and it works fine. Thanks!

skibak commented 1 month ago

verified