Repository navigation
Conversation
The Slack token regex did not include the `xoxc` prefix, so xoxc tokens (used e.g. by IRC bridges) were missed during scans. Fixes Yelp#313
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #313.
The Slack token regex covered
xoxa|b|p|o|s|rbut notxoxc, so xoxc tokens (used e.g. by IRC bridges, as linked in the issue) were silently missed by scans.Changes
detect_secrets/plugins/slack.py: addcto the token-prefix alternation, as suggested in the issue. The existing(?:\d+-)+[a-z0-9]+suffix already matches the xoxc token shape, and case-insensitive matching is unchanged.tests/plugins/slack_test.py: add an xoxc token to the positiveanalyze_lineparametrization.Verification
On current
master(5e14193):SlackDetector.analyze_line, while the xoxb control yields 1.xoxd-...string and plain text still yield 0.python -m pytest tests/plugins/slack_test.py -q— 9 passed (8 pre-existing + the new case; the new case fails without the regex change).python -m pytest tests -q— 1023 passed, 11 failed, 6 xfailed. The 11 failures are all intests/plugins/aws_key_test.pyandtests/plugins/base_test.py(verification/network-related tests) and also fail on unmodifiedmasterin this sandbox, so they are unrelated to this two-line change.