ex-aws / ex_aws

A flexible, easy to use set of clients AWS APIs for Elixir
https://hex.pm/packages/ex_aws
MIT License
1.26k stars 521 forks source link

Increase AWS -related auth. compatibility #921

Closed paulo-ferraz-oliveira closed 1 year ago

paulo-ferraz-oliveira commented 1 year ago

I'm using localstack to perform local tests on top of ex_aws.

I'm getting the following error

"Authorization header requires \\Signature\\ parameter. Authorization header requires \\SignedHeaders\\ parameter.

as part of HTTP calls. I've run the request with debug_requests: true and found that the Authorization header does have those parameters, but... they're written like this

AWS4-HMAC-SHA256 Credential=<cred>,SignedHeaders=<sign_head>,Signature=<sign>

instead of

AWS4-HMAC-SHA256 Credential=<cred>, SignedHeaders=<sign_head>, Signature=<sign>
                                   ^ notice the extra space

This pull request adds the extra space, which is what's issued by the official AWS client, in any case.

I also add LocalStack to CI for future regression testing purposes (if CI isn't running - because this is my first contribution to the repo., you can check results here: https://github.com/paulo-ferraz-oliveira/ex_aws/actions/runs/3726712502/jobs/6320334886).

paulo-ferraz-oliveira commented 1 year ago

I've pushed a commit to paulo-ferraz-oliveira/ex_aws where we can see the old code fail: https://github.com/paulo-ferraz-oliveira/ex_aws/actions/runs/3726731391/jobs/6320365816#step:7:146

paulo-ferraz-oliveira commented 1 year ago

I'm now reconsidering if this ("fixing" ex_aws) is the best approach to the problem explained above (since we'd be adapting the client to the server behaviour, but that one might not be fully compliant with expectations) so would be Ok to have the pull request closed without merge.

References:

paulo-ferraz-oliveira commented 1 year ago

The issue, as presented before, was found to be in LocalStack's default imported kinesis-mock. The latter is now fixed, while the former allows importing a specific version of the latter. All good!