Skip to content

Detect Slack xoxc tokens - #1005

Open
josaum wants to merge 1 commit into
Yelp:masterfrom
josaum:fix/slack-xoxc-tokens
Open

josaum wants to merge 1 commit into
Yelp:masterfrom
josaum:fix/slack-xoxc-tokens

Conversation

@josaum

@josaum josaum commented Oct 25, 2026

Copy link
Copy Markdown

Fixes #313.

The Slack token regex covered xoxa|b|p|o|s|r but not xoxc, 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: add c to 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 positive analyze_line parametrization.

Verification

On current master (5e14193):

  • Reproduced the false negative before the change: the xoxc sample yields 0 findings with SlackDetector.analyze_line, while the xoxb control yields 1.
  • After the change: xoxc yields 1 finding; a non-token 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).
  • Full suite python -m pytest tests -q — 1023 passed, 11 failed, 6 xfailed. The 11 failures are all in tests/plugins/aws_key_test.py and tests/plugins/base_test.py (verification/network-related tests) and also fail on unmodified master in this sandbox, so they are unrelated to this two-line change.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support finding Slack xoxc tokens

1 participant