mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 18:16:52 +00:00
commit
79915aa6ef
3 changed files with 9 additions and 1 deletions
|
|
@ -53,7 +53,9 @@ def get_aws_secrets_from_file(credentials_file):
|
|||
'aws_session_token',
|
||||
):
|
||||
try:
|
||||
keys.add(parser.get(section, var))
|
||||
key = parser.get(section, var).strip()
|
||||
if key:
|
||||
keys.add(key)
|
||||
except configparser.NoOptionError:
|
||||
pass
|
||||
return keys
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
# file with an AWS access key id but no valid AWS secret access key only space characters
|
||||
[production]
|
||||
aws_access_key_id = AKIASLARTARGENTINA86
|
||||
aws_secret_access_key =
|
||||
|
|
@ -83,6 +83,7 @@ def test_get_aws_secrets_from_env(env_vars, values):
|
|||
},
|
||||
),
|
||||
('aws_config_without_secrets.ini', set()),
|
||||
('aws_config_without_secrets_with_spaces.ini', set()),
|
||||
('nonsense.txt', set()),
|
||||
('ok_json.json', set()),
|
||||
),
|
||||
|
|
@ -100,6 +101,7 @@ def test_get_aws_secrets_from_file(filename, expected_keys):
|
|||
('aws_config_with_session_token.ini', 1),
|
||||
('aws_config_with_multiple_sections.ini', 1),
|
||||
('aws_config_without_secrets.ini', 0),
|
||||
('aws_config_without_secrets_with_spaces.ini', 0),
|
||||
('nonsense.txt', 0),
|
||||
('ok_json.json', 0),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue