detect-aws-credentials fails when no credentials are set
See original GitHub issueAs part of our developer setup, each person installs the pre-commit and inherits the project’s hooks, but not everyone has aws credentials set up, so detect-aws-credentials
will product a failure when the individual hasn’t set any keys file or has any exported to their env.
I’m not sure of the best way to handle this within the current logic - I’d rather exit 0 with a passing warning than fail, since this then forces the individual to go and set up a credentials file, even if they don’t use one.
I guess the “simple” workaround is to export AWS_SECRET_ACCESS_KEY="RANDOMSTRINGTHATNEVERTEXISTSINMYCODE!!"
before running the pre-commit hooks, but this seems wrong.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Resolve "Unable to locate credentials" error in ... - Amazon AWS
An "Unable to locate credentials" error indicates that Amazon S3 can't find the credentials to authenticate AWS API calls.
Read more >Resolve "Unable to locate credentials" error in Amazon S3
An "Unable to locate credentials" error indicates that Amazon S3 can't find the credentials to authenticate AWS API calls. To resolve this issue, ......
Read more >1 - Stack Overflow
It seems a simple task, but somehow it fails: AWS client does not see the credentials specified in ~/.aws/credentials .
Read more >How do I fix the error "Unable to locate credentials ... - YouTube
How do I fix the error " Unable to locate credentials " when I connect to my S3 bucket with AWS CLI?
Read more >AWS DynamoDB CredentialsError: Missing credentials in config
Missing credentials in the config, if using AWS_CONFIG_FILE, set ... something is wrong with your AWS Credentials and this is not DynamoDB specific...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it can, that’s what
--allow-missing-credentials
is forthe reason it does not do that by default, is you may not have your credentials configured properly and therefore it can’t protect you against mistakes
Failing when no credentials are configured has been the behavior since the very first version of this hook. An obvious solution would be of course to simple remove the following lines: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/detect_aws_credentials.py#L114-L120
I agree that removing those lines would allow silent failures in cases where a user with credentials in some obscure location installs the hook and expects it to work without having tested it.
My proposal to solve this problem is to simply introduce an additional argument for the script, providing the ability to simply disable failures when no credentials are found, but keeping the current behavior the default.