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

New Artifactory / Slack Patterns #195

Merged
merged 1 commit into from
Jun 19, 2019
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
6 changes: 3 additions & 3 deletions detect_secrets/plugins/artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ArtifactoryDetector(RegexBasedDetector):

denylist = [
# artifactory tokens begin with AKC
re.compile(r'(?:\s|=|:|"|^)AKC\w{10,}'), # api token
# artifactory encrypted passwords begin with AP6
re.compile(r'(?:\s|=|:|"|^)AP6\w{10,}'), # password
re.compile(r'(?:\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}'), # api token
# artifactory encrypted passwords begin with AP[A-Z]
re.compile(r'(?:\s|=|:|"|^)AP[\dABCDEF][a-zA-Z0-9]{8,}'), # password
]
8 changes: 8 additions & 0 deletions detect_secrets/plugins/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@ class SlackDetector(RegexBasedDetector):
secret_type = 'Slack Token'

denylist = (
# Slack Token
re.compile(r'xox(?:a|b|p|o|s|r)-(?:\d+-)+[a-z0-9]+', flags=re.IGNORECASE),
# Slack Webhooks
re.compile(
r"""
https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}
""",
flags=re.IGNORECASE | re.VERBOSE,
),
)
7 changes: 6 additions & 1 deletion tests/plugins/artifactory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ class TestArtifactoryDetector(object):
'payload, should_flag',
[
('AP6xxxxxxxxxx', True),
('AP2xxxxxxxxxx', True),
('AP3xxxxxxxxxx', True),
('AP5xxxxxxxxxx', True),
('APAxxxxxxxxxx', True),
('APBxxxxxxxxxx', True),
('AKCxxxxxxxxxx', True),
(' AP6xxxxxxxxxx', True),
(' AKCxxxxxxxxxx', True),
Expand All @@ -28,7 +33,7 @@ class TestArtifactoryDetector(object):
('testAP6withinsomeirrelevantstring', False),
('X-JFrog-Art-Api: $API_KEY', False),
('X-JFrog-Art-Api: $PASSWORD', False),
('artifactory:_password=AP6xxxxxxxx', False),
('artifactory:_password=AP6xxxxxx', False),
('artifactory:_password=AKCxxxxxxxx', False),
],
)
Expand Down
3 changes: 3 additions & 0 deletions tests/plugins/slack_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class TestSlackDetector(object):
(
'xoxb-34532454-e039d02840a0b9379c'
),
(
'https://hooks.slack.com/services/Txxxxxxxx/Bxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx'
),
],
)
def test_analyze(self, file_content):
Expand Down