feat(auth): flag placeholder & default credentials (PLACEHOLDER_CREDENTIAL)#43
Open
dmchaledev wants to merge 1 commit into
Open
feat(auth): flag placeholder & default credentials (PLACEHOLDER_CREDENTIAL)#43dmchaledev wants to merge 1 commit into
dmchaledev wants to merge 1 commit into
Conversation
…NTIAL)
A long placeholder or default credential (>= 32 chars, not JWT-shaped)
such as "your-api-key-here-replace-before-prod" satisfied NO_AUTH (a
credential is present) and passed WEAK_API_KEY (length ok), so a config
shipped with an unfilled or default credential went green on the gate.
Add a HIGH PLACEHOLDER_CREDENTIAL rule that inspects transport.auth.apiKey
and transport.auth.token for:
- unresolved template markers (<your-key>, {{API_KEY}}, ${TOKEN})
- filler/repeated-character fillers (xxxxxxxx)
- known default/weak secrets (changeme, password, admin, ...)
- high-signal placeholder phrases (your-api-key, replace-me, ...)
Matching is anchored to the whole normalized value (defaults) or
multi-character high-signal phrases (placeholders) to keep false
positives near zero: real random keys and JWTs are not flagged. Rule
requires a config file, so URL mode is unaffected. Additive only; no
change to existing rules or output schema.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FP2Zbbft758mDMK2Edcbd
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.
Summary
Closes a real false-negative on the scanner's core auth checks: a long placeholder or default credential passes the gate today.
NO_AUTHaccepts any non-emptyapiKey/tokenas proof that auth is configured, andWEAK_API_KEYonly checks length (and exempts JWTs). So a config shipped with an unfilled credential like"your-api-key-here-replace-before-prod"(37 chars, not a JWT) satisfies both and produces zero findings — the gate goes green on a server anyone can authenticate to with a publicly-known value.Repro (built CLI at current
main)After this change the same config reports a HIGH
PLACEHOLDER_CREDENTIAL.Change
New HIGH
PLACEHOLDER_CREDENTIALrule (src/rules/auth-rules.ts) inspectingtransport.auth.apiKeyandtransport.auth.tokenfor:<your-key>,{{API_KEY}},${TOKEN}xxxxxxxx,00000000changeme,password,admin,root,secret, … (matched against the whole normalized value)your-api-key,replace-me,insert-your-key,placeholder,redacted, … (multi-character substrings only — no barekey/token/test)Matching is deliberately anchored to keep the false-positive rate near zero:
kZ8f3Qw9Lx2Vt7Rb1Np6Yc4Md0Ha5Ue→ clean).examples/secure-config.jsonstays clean and stillPASSED.The matched value is a placeholder/default (not a real secret), so a short slice is safely included in
evidenceto locate the offending field.Scope / safety
RuleIdis auto-picked up by the CLI/--ruleallowlists and SARIF.URL_EVALUABLE_RULES).WEAK_API_KEY: short placeholders still tripWEAK_API_KEYon length; the gap this closes is long placeholders that pass length.Tests / verification
npx tsc --noEmit✅ ·npm run lint(0 warnings) ✅ ·npm test✅ 132 passed (was 118) ·npm run build✅PLACEHOLDER_CREDENTIALsuite: the long-placeholder regression (assertsWEAK_API_KEYdoes not fire on the same value), a parametrized case per detection category, independent apiKey+token flagging, and no-false-positive guards for a random key, a JWT, and an absent credential.examples/secure-config.jsonremains clean.Note on backlog overlap
Independent of the open backlog — the three open
EXPOSED_SECRETSPRs (#28/#35/#38) concern hardcoded real secrets and their redaction; #26 concerns credential length; #39 concerns themcpServersstdio schema. None address placeholder/default credentials.🤖 Generated with Claude Code
https://claude.ai/code/session_013FP2Zbbft758mDMK2Edcbd
Generated by Claude Code