Repository navigation
fix: redact standalone apikey_ credentials (#147) - #242
Conversation
[Medium impact] The PR appears safe to merge. Reviews (1) · Last reviewed commit: "no-mistakes(document): Document redactio..." · Reviewed by Greptile |
|
Speaking as Kun's firstmate. I reviewed the diff (no workflow, network, or exec changes) and approved fork CI. Everything is green, including no-mistakes, and the PR is CLEAN against latest main VISION per-rule:
Contract-class: restore. Redaction already promises a coarse net over obvious secret shapes on the default distill path; this adds a missing common shape, not a new surface. Merging. |
|
Speaking as Kun's firstmate: this is merged. Thank you @WTF-Am-ID — really appreciate you taking the time on this. |
Intent
1 p1-p7 codex only no cross model review
Context: this task is upstream scan 3 pick P2: upstream issue #147 in kunchenguid/backpass. The owner approved fixing scan picks P1-P7 upstream through PRs, written and reviewed by Codex only, with no cross-model review. Scan notes for this pick:
Issue: #147
Backpass leaves standalone lowercase and uppercase
apikey_credentials unredacted.Size S.
Contract class: restore.
Recorded triage.
Current-source evidence: Pinned Backpass
src/redact.js:8-28has specific token grammars and assignment handling but no standaloneapikey_grammar.Competing-work check: No exact target across all 18 open proposal bodies/titles. All 18 changed-file inventories were checked. Our #237 touches
src/redact.jsto return replacement offsets, but its actual diff keeps PATTERNS unchanged and contains noapikeytoken. It does not implement this missing grammar. Coordinate the ordinary rebase if the offset work lands first.Closure test: Use fake token strings only. Exercise
redact()with lowercase, uppercase, punctuation-delimited and multilineapikey_plus the maintainer's token-length floor. Verify no full token survives in the distilled prompt/cache path. Pin short-token and ordinary-word negative controls and existing assignment/token formats. Removing the new grammar must make the regression fail. Run the relevant Node tests, then the repository'spnpm run check.What Changed
apikey_credentials case-insensitively with a 16-character suffix minimum, after assignment redaction to keep secret values protected.Risk Assessment
✅ Low: The narrow matcher addition preserves existing provider rules, and the revised ordering resolves the assignment collision without expanding scope.
Testing
Both permitted test files and all live prompt-cache scenarios passed. Baseline, grammar-removal, and prior-revision probes reproduced the reported failures. Product outputs were retained. Cleanup was rejected by the command guard, leaving ignored scratch under
.local-test-147/.Evidence: Actual CLI-generated analysis prompt
Evidence: Synthetic inputs and observed redaction outputs
Evidence: Assignment leak reproduced before fix and protected afterward
Evidence: CLI invocation and prompt-checkpoint termination
~/.no-mistakes-upstream-codex/evidence/01M619JAT2F2MH08ZZX7R87MT6/cleanup-notes.json)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
src/redact.js:13- The new pattern destroys assignment names before the assignment rule at src/redact.js:26 can protect their values. For synthetic inputAPIKEY_OPENROUTER_PRODUCTION=hunter2hunter2, the baseline redacts the value, but this change produces[redacted:API_KEY]=hunter2hunter2. The same regression affects lowercase names,:separators, and quoted values. It reaches message text and tool input/output through src/distill.js:111,121,122, then the cached prompt and model call at src/analyze.js:313,328. Preserve assignment recognition before standalone replacement can erase its name, and add behavioral regression coverage for these forms.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
TMPDIR="$PWD/.local-test-147/tmp" node --import ./test/helpers/hermetic-config.js --test test/distill.test.js test/analyze-reuse.test.jsnode .local-test-147/drive.mjs: executed the real CLI against isolated synthetic Codex transcripts, checked 44 cases and tool fields, and retained the generated promptStopped the CLI at the persisted-prompt checkpoint; analysis completion and model response were outside this checkExecuted baseline and grammar-removal redactors against synthetic credentials; both reproduced the missing-redaction regressionExecuted revision 4413883 against assignment fixtures; reproduced the leak and confirmed the target protects the valuesCorrected an initial fixture collision between a credential and its embedded-prefix negative control, then repeated the CLI probe successfullyInventoried retained scratch and confirmed tracked files were unchanged✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.