Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AWS access key detection #796

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions detect_secrets/plugins/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class AWSKeyDetector(RegexBasedDetector):
secret_keyword = r'(?:key|pwd|pw|password|pass|token)'

denylist = (
re.compile(r'AKIA[0-9A-Z]{16}'),
re.compile(r'(?:A3T[A-Z0-9]|ABIA|ACCA|AKIA|ASIA)[0-9A-Z]{16}'),

# This examines the variable name to identify AWS secret tokens.
# The order is important since we want to prefer finding `AKIA`-based
# The order is important since we want to prefer finding access
# keys (since they can be verified), rather than the secret tokens.

re.compile(
Expand Down
16 changes: 16 additions & 0 deletions tests/plugins/aws_key_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ def setup(self):
'AKIAZZZ',
False,
),
(
'A3T0ZZZZZZZZZZZZZZZZ',
True,
),
(
'ABIAZZZZZZZZZZZZZZZZ',
True,
),
(
'ACCAZZZZZZZZZZZZZZZZ',
True,
),
(
'ASIAZZZZZZZZZZZZZZZZ',
True,
),
(
'aws_access_key = "{}"'.format(EXAMPLE_SECRET),
True,
Expand Down
Loading