diff --git a/detect_secrets/plugins/slack.py b/detect_secrets/plugins/slack.py index 15e494813..1d1527c32 100644 --- a/detect_secrets/plugins/slack.py +++ b/detect_secrets/plugins/slack.py @@ -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, ), ) @@ -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',