fix(s3deploy): use default credentials chain when access key / secret are not provided#512
fix(s3deploy): use default credentials chain when access key / secret are not provided#512HunterLarco wants to merge 2 commits intobep:masterfrom
Conversation
|
|
||
| // The region may be possible for the AWS SDK to figure out from the context. | ||
|
|
||
| if cfg.AccessKey == "" { |
There was a problem hiding this comment.
Note for reviewers: these are no longer required because the aws credential chain will automatically inspect environment variables
d9d04e7 to
5ca1b74
Compare
|
@HunterLarco I re-ran your previous PR with same test failure (it basically fails in the common case with a secret in the env), which is obviously not somehting that I can release. I will look into this later (as in a day or two). Are you sure you rebased this against master? |
|
Thinking about it, I suspect the tests do not trigger on reopen. Please create a brand new PR to remove any confusion. |
|
@bep I misspoke when I said it was "reopened".. this was a brand new PR (rebased from your recent changes to the github workflow on master) 😅 I can open a 3rd one if you'd prefer. I also just confirmed that all of the following setups work using this PR # env variable
AWS_ACCESS_KEY_ID='<redacted>' AWS_SECRET_ACCESS_KEY='<redacted>' s3deploy ...
# arguments
s3deploy -key '<redacted>' -secret '<redacted>' ...
# config file
s3deploy ...I also validated just now against the reverted PR and was unable to replicate the integration test failure. Something must be different in the test setup but I'm not clearly seeing what it might be. I'd appreciate if you'd take a look when you have a moment |
|
^ bump~ @bep would you like me to open a duplicate or can we reopen this one? |
Fixes #509
TL;DR the current credentials loading logic does not use aws's default credential provider chain, preventing users from using the myriad of aws options (config files, sso, environment variables, etc...). This PR preserves the existing behavior of
-keyand-secretoptions while expanding how aws finds credentials when those overrides are not defined.See https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/configure-gosdk.html
Backwards Compatibility
Tests pass, to my knowledge this should only impact users who don't set
-keyand-secretand does not remove existing authorization options, it just adds new ones. So it should be safe.Version Updates
We need a new dependency for the default config factory so I ran:
This in turn pulled in several transitive dependencies which are all related to the default credential provider change (such as sso dependencies) so this look as expected.
Testing
Tests pass and I have tested this PR locally with my own repo and can confirm that it works for the following setups: