Skip to content

Commit

Permalink
fix regex for longer slack webhook urls and added another error response
Browse files Browse the repository at this point in the history
  • Loading branch information
yoni authored and yoni committed Aug 8, 2020
1 parent cd8b399 commit a0c1d30
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions detect_secrets/plugins/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ class SlackDetector(RegexBasedDetector):
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}
""",
r'https://hooks.slack.com/services/T[a-zA-Z0-9_]+/B[a-zA-Z0-9_]+/[a-zA-Z0-9_]+',
flags=re.IGNORECASE | re.VERBOSE,
),
)
Expand All @@ -33,7 +31,7 @@ def verify(self, token, **kwargs): # pragma: no cover
'text': '',
},
)
valid = response.text == 'missing_text_or_fallback_or_attachments'
valid = response.text in ['missing_text_or_fallback_or_attachments', 'no_text']
else:
response = requests.post(
'https://slack.com/api/auth.test',
Expand Down

0 comments on commit a0c1d30

Please sign in to comment.