fix(classifier): bound auth and token secret patterns#109
Merged
Conversation
Unbounded substrings `auth` and `token` in DangerDetector.SECRETS_AUTH matched benign words such as "authorization" and "tokenization", forcing the high-risk `blocked` profile. Anchor them to word boundaries (`\bauth\b`, `\btokens?\b`) so genuine credential material still blocks while authentication/authorization protocol language does not. Add a regression matrix over benign and sensitive prompts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for poetic-quokka-0fd859 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
coreytshaffer
marked this pull request as ready for review
July 23, 2026 07:00
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.
What
DangerDetector.SECRETS_AUTHused unbounded substringsr"auth"andr"token", so benign prompts containing words like authorization, authentication, or tokenization matched and were forced into the high-riskblockedprofile — which would block the CR-YK approval demo's own authorization prompts from ever reaching the gate (pre-hackathon audit finding F1).This anchors both to word boundaries —
\bauth\band\btokens?\b— so genuine credential material still blocks while protocol/architecture language does not.auth token,OAuth refresh token,OAuth client secret,stored credentials→ stillblockedauthorization plan,authentication architecture,OAuth callback flow,tokenization algorithm→ no longerblockedNo blanket
oauthrule: OAuth is a protocol name, not credential material — the dangerous OAuth cases are already caught viatoken/secret/credentials.Scope
Two files only:
Verification
pytest tests/test_classifier.py tests/test_routers.py -q→ 19 passed (7 pre-existing classifier + 8 new parametrized cases + 4 router consumers)git diff --check→ cleanKnown pre-existing lint (intentionally out of scope)
ruff check triage_core/classifier.pyreports 2F401unused imports —typing.Dictandtyping.Anyon line 2 — that predate this change and sit on untouched lines. Left as-is to keep this patch strictly the auth/token fix; the unused-import cleanup is tracked separately.🤖 Generated with Claude Code