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

Add context to Artifactory encrypted token #229

Merged
merged 5 commits into from
Nov 18, 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/artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class ArtifactoryDetector(RegexBasedDetector):
# API token:
re.compile(r'(?:\s|=|:|"|^)AKC[a-zA-Z0-9]{10,200}(?:\s|"|$)'),
# Artifactory encrypted passwords begin with AP[A-Z]
# Password:
re.compile(r'(?<!AAAA[_\-\w]{7})(?:\s|=|:|"|^)AP[\dABCDEF][a-zA-Z0-9]{8,200}(?:\s|"|$)'),
# Keyword with Password:
re.compile(r'(?<!AAAA[_\-\w]{7})(?i:artif|jfrog|buildkit)(?:.{0,100}\n?){0,2}(?:\s|=|:|"|^)(AP[\dABCDEF][a-zA-Z0-9]{8,200})(?:\s|"|$)'),
]
19 changes: 10 additions & 9 deletions tests/plugins/artifactory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ class TestArtifactoryDetector:
@pytest.mark.parametrize(
'payload, should_flag',
[
('AP6xxxxxxxxxx', True),
('AP2xxxxxxxxxx', True),
('AP3xxxxxxxxxx', True),
('AP5xxxxxxxxxx', True),
('APAxxxxxxxxxx', True),
('APBxxxxxxxxxx', True),
('artifactory = AP6xxxxxxxxxx', True),
('artifactory = ap6xxxxxxxxxx', False),
('artif \n key=AP2xxxxxxxxxx', True),
('jfrog AP3xxxxxxxxxx', True),
('jfrog AP5xxxxxxxxxx', True),
('jfrog APAxxxxxxxxxx', True),
('jfrog APBxxxxxxxxxx', True),
('AKCxxxxxxxxxx', True),
(' AP6xxxxxxxxxx', True),
('jfrog_secret=AP6xxxxxxxxxx', True),
(' AKCxxxxxxxxxx', True),
('=AP6xxxxxxxxxx', True),
('artifactory_secret=AP6xxxxxxxxxx', True),
('=AKCxxxxxxxxxx', True),
('\"AP6xxxxxxxxxx\"', True),
('artif \"AP6xxxxxxxxxx\"', True),
('\"AKCxxxxxxxxxx\"', True),
('artif-key:AP6xxxxxxxxxx', True),
('artif-key:AKCxxxxxxxxxx', True),
Expand Down
Loading