fix(redact): close emission gaps - env suffix keys, control-char splits, process(list) (#77484) - #80643
fix(redact): close emission gaps - env suffix keys, control-char splits, process(list) (#77484)#80643thatssoheil wants to merge 2 commits into
Conversation
Related to #77768, which already addresses the #77484 redaction and process-list gaps and also covers checkpoint persistence and masked-display control characters. The control-character handling differs, so these are competing implementations rather than duplicates; consider consolidating. |
… opaque values (review)
|
Review resolved (dbbf447): the reviewer found 4 of 9 new tests false-passed on old code — Fixed:
Re-verified RED-GREEN: on old code 5/8 new tests fail (suffix keys, lowercase env, all 3 control-splits); on new code 8/8 pass. Full 4-suite run: 144/144 green. |
|
Merged via #80965 — all four of your commits were cherry-picked with your authorship preserved (you show as author on main for each). The salvage combined the best halves of your two PRs: this PR's body (span-local control-split masking, word-bounded all-caps matching, the hardened #77484 tests, process(list) via inline map) plus the two pieces #77768 had that this one lacked — the One follow-up landed on top: CI caught that Thanks for the thorough work across both iterations, including hardening your own tests after the first review round. |
Fixes #77484
Closes the three-part redaction emission class verified live on main:
1.
_ENV_ASSIGN_REmisses*_KEY/*_PASS/*_PW(+ lowercase env names)KEY/PASS/PWsuffixes to_SECRET_ENV_NAMES(FAL_KEY=…,MYSQL_PASS=…,DB_PW=…now mask)_ENV_ASSIGN_LOWER_REcatches lowercase env names (openai_key=…) — underscore-boundary only, sopassword=/token=in prose/URLs/form bodies are untouched (URL guard: skipped when://present)_key_has_secret_keywordall-caps branch now uses word-boundary matching:KEYBOARD=/PASSAGE=(prose) stay,API_KEY/FAL_KEY/DB_PWmask2. Control-char / zero-width token splits escape every regex
sk-abc\x1bdef…,ghp_abc\n123…, zero-width splits — the contiguous_PREFIX_REcouldn't match across the split, leaking the secret verbatim. New_mask_control_split_tokensstrips control chars for matching (token becomes contiguous, matching even when each fragment alone is too short), then masks the original span — with guard rails so unrelated env lines (SHELL=/bin/bash\nEXA_API_KEY=…) never get joined into a false match.3.
process(action=list)returns unredacted outputtools/process_registry.py:2495returned rawcommand[:200]+output_preview[-200:]with no redaction wrap, unlike poll/log/wait/kill. The list branch now runs each entry through_redact_process_result.Tests
TestBareSecretEnvSuffixes,TestControlCharSplitTokens) — RED on old codetest_list_redacts_command_and_output) — RED on old codetests/agent/test_redact.py+tests/tools/test_process_registry.py+ browser/kanban redaction suites: 144/144 green