Skip to content

fix(detector): calibrate WEAK_CIPHER (kill .includes false positives) + unique IDs + downgrade test findings#17

Merged
decksoftware merged 1 commit into
mainfrom
fix/detector-calibration-weak-cipher
Jun 3, 2026
Merged

fix(detector): calibrate WEAK_CIPHER (kill .includes false positives) + unique IDs + downgrade test findings#17
decksoftware merged 1 commit into
mainfrom
fix/detector-calibration-weak-cipher

Conversation

@decksoftware

Copy link
Copy Markdown
Owner

Calibrate the internal detector (kill the WEAK_CIPHER false positives)

Driven by real user feedback (thanks @thiago): "the internal detector is shouting fire because it saw the word match in the dictionary." On a real project it flagged args.includes('--no-update-check') and ids.includes('postgres') as CRITICAL Weak Cipher — dropping the score to 0/100 and making the report untrustworthy.

Root cause

The WEAK_CIPHER regex had a bare (?:DES|RC4|Blowfish|ECB)\b alternative — case-insensitive, no leading word boundary — so it matched the des substring inside includes, excludes, modes, etc. 150 of 192 detector findings on csreview's own code were this single FP.

Fixes

  1. WEAK_CIPHER is now context-bound — it only matches real crypto APIs (createCipheriv, Cipher.getInstance, CryptoJS.*, <Algo>.new(, MODE_ECB, algorithm:/cipher: config) with proper word boundaries. Never a bare substring. (addresses suggestion chore(deps): bump actions/checkout from 5 to 6 #2)
  2. Deterministic, globally-unique IDs — the old ${id}_${index} scheme reset per file, so WEAK_CIPHER_0 appeared in every file. (addresses [codex] Expose canonical SKILL.md on README #5)
  3. Non-source findings downgraded — findings in tests/, fixtures/, examples/, docs/, *.test.*, *.spec.* are downgraded to LOW + confidence LOW, so intentional test vectors / example keys don't crater the score (they stay visible, not hidden). (addresses [codex] Clarify CSReview scope and add GitHub security validation #1)

Score (#4) recovers naturally once the bogus CRITICALs are gone; the severity cap is a deliberate design choice. Origin-grouping in the report (#3) — findings already carry source + confidence; a grouped view can follow up.

Effect (measured on csreview's own tree)

192 -> 51 detector findings · 0 duplicate IDs · the .includes() FPs gone · recall preserved (real weak-cipher usage still flagged). The residual src/ CRITICAL/HIGH are csreview matching its own rule definitions in detector.js (only when auditing csreview itself — not a user project).

Tests: +4 calibration + 3 negative-corpus guards. 175/175 · lint clean · typecheck 0.

🤖 Generated with Claude Code

…e findings

User feedback: the internal detector "shouted fire because it saw the word match
in the dictionary." On a real project it flagged args.includes('--no-update-check')
and ids.includes('postgres') as CRITICAL Weak Cipher, because the WEAK_CIPHER regex
matched the "des" substring in inclu-des / exclu-des / mo-des (the bare
(?:DES|RC4|Blowfish|ECB)\b alternative: case-insensitive, no leading boundary).
150 of 192 detector findings on csreview's own code were this FP, cratering the
score to 0/100.

- WEAK_CIPHER is now context-bound: only real crypto APIs (createCipheriv,
  Cipher.getInstance, CryptoJS.*, <Algo>.new(), MODE_ECB, algorithm/cipher config)
  with proper word boundaries. Never a bare cipher-name substring.
- Deterministic, globally-unique finding IDs (the old ${id}_${index} scheme
  collided across files, e.g. WEAK_CIPHER_0 in every file).
- Findings in non-source paths (tests/fixtures/examples/docs) are downgraded to
  LOW + confidence LOW so intentional test vectors and example keys do not crater
  the score; they stay visible rather than hidden.

Effect on csreview's own tree: 192 -> 51 detector findings, 0 duplicate IDs, the
.includes() false positives gone. Recall preserved (real weak-cipher usage still
flagged). Remaining src CRITICAL/HIGH are csreview matching its own rule
definitions in detector.js (only when scanning csreview itself).

Tests: +4 calibration + 3 negative-corpus guards. 175/175 - lint clean - typecheck 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@decksoftware decksoftware merged commit ea9b20f into main Jun 3, 2026
12 checks passed
@decksoftware decksoftware deleted the fix/detector-calibration-weak-cipher branch June 3, 2026 14:05
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