Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pre Commit Hooks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
opensource
Pre Commit Hooks
Commits
45cb6a35
Unverified
Commit
45cb6a35
authored
5 years ago
by
Anthony Sottile
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #450 from begoon/master
Skip empty key variables in detect_aws_credentials
parents
a18c5af5
b3a28dec
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pre_commit_hooks/detect_aws_credentials.py
+1
-1
1 addition, 1 deletion
pre_commit_hooks/detect_aws_credentials.py
tests/detect_aws_credentials_test.py
+2
-0
2 additions, 0 deletions
tests/detect_aws_credentials_test.py
with
3 additions
and
1 deletion
pre_commit_hooks/detect_aws_credentials.py
+
1
−
1
View file @
45cb6a35
...
...
@@ -31,7 +31,7 @@ def get_aws_secrets_from_env() -> Set[str]:
for
env_var
in
(
'
AWS_SECRET_ACCESS_KEY
'
,
'
AWS_SECURITY_TOKEN
'
,
'
AWS_SESSION_TOKEN
'
,
):
if
env_var
in
os
.
environ
:
if
os
.
environ
.
get
(
env_var
)
:
keys
.
add
(
os
.
environ
[
env_var
])
return
keys
...
...
This diff is collapsed.
Click to expand it.
tests/detect_aws_credentials_test.py
+
2
−
0
View file @
45cb6a35
...
...
@@ -47,6 +47,8 @@ def test_get_aws_credentials_file_from_env(env_vars, values):
({
'
AWS_SECRET_ACCESS_KEY
'
:
'
foo
'
},
{
'
foo
'
}),
({
'
AWS_SECURITY_TOKEN
'
:
'
foo
'
},
{
'
foo
'
}),
({
'
AWS_SESSION_TOKEN
'
:
'
foo
'
},
{
'
foo
'
}),
({
'
AWS_SESSION_TOKEN
'
:
''
},
set
()),
({
'
AWS_SESSION_TOKEN
'
:
'
foo
'
,
'
AWS_SECURITY_TOKEN
'
:
''
},
{
'
foo
'
}),
({
'
AWS_DUMMY_KEY
'
:
'
foo
'
,
'
AWS_SECRET_ACCESS_KEY
'
:
'
bar
'
},
{
'
bar
'
}),
(
{
'
AWS_SECRET_ACCESS_KEY
'
:
'
foo
'
,
'
AWS_SECURITY_TOKEN
'
:
'
bar
'
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment