Skip to content

feat(detectors): detect Sentry auth tokens - #83

Merged
omerbek merged 1 commit into
omerbek:mainfrom
aplatogg:feat/sentry-token-detector
Nov 23, 2026
Merged

omerbek merged 1 commit into
omerbek:mainfrom
aplatogg:feat/sentry-token-detector

Conversation

@aplatogg

Copy link
Copy Markdown
Contributor

Closes #67.

Adds one detector for Sentry auth tokens and keeps DSNs out of the report.

  • SECRET_PATTERNS: ("Sentry auth token", r"\bsntry[su]_[A-Za-z0-9+/=_\-]{40,}")
  • CANDIDATE_LITERALS: "sntry", so lines without the prefix are still skipped early
  • Tests: the org token goes into test_detects_provider_keys, plus test_detects_sentry_user_token for sntryu_ and test_ignores_sentry_dsn for https://abc@o123.ingest.sentry.io/456

The DSN case matters: SENTRY_DSN is a public value, so reporting it would be a false alarm on nearly every Sentry project. The token prefix makes the two easy to separate, and the negative test pins it.

Verification:

$ python -m unittest discover
Ran 117 tests
FAILED (errors=1)

The one error is StagedScanTests.test_scans_index_contents_and_handles_unusual_paths, which writes a file named odd name\n.js — Windows rejects \n in filenames (OSError: [Errno 22]). It fails identically on main here, so it is this machine, not the branch; Linux CI is unaffected. All SecretScanTests pass, including the three Sentry cases.

$ python repodx.py .
Score: 100/100 (A)
Found: 0 critical, 0 warnings, 0 info

CHANGELOG.md untouched since it is written at release time.

Sentry DSNs are public by design and stay unflagged; only the sntrys_/sntryu_
auth tokens are reported. Closes omerbek#67.
@omerbek
omerbek merged commit df41231 into omerbek:main Nov 23, 2026
3 checks passed
@omerbek omerbek mentioned this pull request Nov 23, 2026
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.

Detect Sentry auth tokens (sntrys_, sntryu_)

2 participants