Skip to content

fix(detectors): detect current token formats and close dead branches - #110

Merged
pixincreate merged 1 commit into
masterfrom
fix/detector-formats
Sep 14, 2026
Merged

pixincreate merged 1 commit into
masterfrom
fix/detector-formats

Conversation

@pixincreate

Copy link
Copy Markdown
Owner

Stacked PR 2 of 5 (base: refactor/module-file-layout, merges after #109).

Detector fixes, verified end to end:

New detections: GitHub fine-grained PATs (github_pat_) and ghr_ refresh tokens, modern Slack bot tokens plus xapp- app tokens and webhook URLs, AWS ASIA/ABIA/ACCA prefixes and a context-gated AWS secret access key rule, OpenAI project keys (sk-proj-/sk-svcacct-/sk-admin-), uppercase New Relic NRAK keys, and the auth = / encryption_key = branches of the generic detector that a missing keyword left unreachable.

False positives cut: identity-number detectors (SSN, Aadhaar, PAN, Voter ID, ABHA) now require the line to name the document; Stripe publishable keys report LOW under their own detector; the AWS documentation example secret in .env.example files is allowlisted.

A new regression test pins one realistic sample per format-anchored detector through the real keyword-gate and accept chain, so a keyword/pattern desync can no longer ship silently. Some fixture lines carry keywatch:ignore so scans with older releases stay clean. The committed baseline is regenerated.

@pixincreate
pixincreate force-pushed the refactor/module-file-layout branch from c26dca9 to fc3c1c3 Compare September 14, 2026 16:14
Base automatically changed from refactor/module-file-layout to master September 14, 2026 16:18
Several real-world credential formats were silently undetectable, and a
new regression test now pins one realistic sample per format-anchored
detector through the same keyword-gate and accept chain the scanner
uses, so a keyword/pattern desync can no longer ship unnoticed.

Misses fixed:
- GitHub fine-grained PATs (github_pat_, 82 word characters) get their
  own detector; the old (github)_ branch stopped at the token's inner
  underscore and no keyword covered it. ghr_ refresh tokens added.
- Slack tokens match the modern segment lengths (10-13 digits, 24-char
  bot suffix) plus the xoxa/xoxr version segment. xoxa- was in the
  pattern but not the keywords (dead); xoxr- was a keyword the pattern
  rejected (inert). Slack app tokens (xapp-) and webhook URLs are new.
- AWS access keys cover ASIA/ABIA/ACCA prefixes, and a context-gated
  AWSSecretKeyDetector catches the 40-character secret access key with
  an exact-length terminator so longer base64 runs are not truncated
  into false matches.
- GenericKeyValueDetector gains the auth and _key keywords its pattern
  always had; auth = and encryption_key = lines never reached the
  regex before.
- NRAK New Relic keys match case-insensitively; the lowercase-only
  class could never fire on real uppercase keys.
- OpenAI project keys (sk-proj-/sk-svcacct-/sk-admin-) get their own
  detector; the legacy pattern stopped at the hyphen.

False positives cut:
- Identity-number detectors (SSN, Aadhaar, PAN, Voter ID, ABHA) require
  the line to name the document, matching the HighEntropyDetector
  precedent; any 14-digit order id no longer reports HIGH.
- Stripe publishable keys (pk_) split into their own LOW detector;
  rk_ restricted keys are detected as secrets.
- The AWS documentation example secret in .env.example files is
  allowlisted in the generic detector.

Cleanups: the Kimi detector is upper-bounded at 47 so 48+ character
sk- tokens report under the OpenAI label, the redundant RSA-only
private key detector and the subset HighEntropyDetector alternative
are removed, ya29. requires a minimum length, and pnpm-lock.yaml,
bun.lock(b) and npm-shrinkwrap.json join the default lockfile
excludes. A few fixture lines carry keywatch:ignore so scans with
older releases stay clean, and the committed baseline is regenerated
for the new set.

Assisted-by: Claude Fable 5
Signed-off-by: PiX <69745008+pixincreate@users.noreply.github.com>
@pixincreate
pixincreate merged commit 3fe9a52 into master Sep 14, 2026
7 checks passed
@pixincreate
pixincreate deleted the fix/detector-formats branch September 14, 2026 16:21
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.

1 participant