fix(redact): strip controls from masked secrets - #55321
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
LGTM. Strips control characters from masked secrets. Clean with tests.
7b9d219 to
bc74172
Compare
|
Thanks for the focused regression fix. Current The canonical helper covers the relevant sibling paths: log-token masking via Automated hermes-sweeper review. |
…ch#55319, NousResearch#55321) A masked secret's visible head/tail could carry control bytes (newline, NUL, DEL, C1 0x80-0x9F, zero-width) into config/status/dump output. Strip every control incl. \n/\t (display differs from redact_sensitive_text, which preserves \n/\t as line structure) before slicing; all-control values return the configured empty fallback. Consolidates the previously-closed NousResearch#58079 approach (strip controls before masking) - supersedes it.
…ch#55319, NousResearch#55321) A masked secret's visible head/tail could carry control bytes (newline, NUL, DEL, C1 0x80-0x9F, zero-width) into config/status/dump output. Strip every control incl. \n/\t (display differs from redact_sensitive_text, which preserves \n/\t as line structure) before slicing; all-control values return the configured empty fallback. Consolidates the previously-closed NousResearch#58079 approach (strip controls before masking) - supersedes it.
…5321) A masked secret's visible head/tail could carry control bytes (newline, NUL, DEL, C1 0x80-0x9F, zero-width) into config/status/dump output. Strip every control incl. \n/\t (display differs from redact_sensitive_text, which preserves \n/\t as line structure) before slicing; all-control values return the configured empty fallback. Consolidates the previously-closed #58079 approach (strip controls before masking) - supersedes it.
…ch#55319, NousResearch#55321) A masked secret's visible head/tail could carry control bytes (newline, NUL, DEL, C1 0x80-0x9F, zero-width) into config/status/dump output. Strip every control incl. \n/\t (display differs from redact_sensitive_text, which preserves \n/\t as line structure) before slicing; all-control values return the configured empty fallback. Consolidates the previously-closed NousResearch#58079 approach (strip controls before masking) - supersedes it.
…ch#55319, NousResearch#55321) A masked secret's visible head/tail could carry control bytes (newline, NUL, DEL, C1 0x80-0x9F, zero-width) into config/status/dump output. Strip every control incl. \n/\t (display differs from redact_sensitive_text, which preserves \n/\t as line structure) before slicing; all-control values return the configured empty fallback. Consolidates the previously-closed NousResearch#58079 approach (strip controls before masking) - supersedes it.
…ch#55319, NousResearch#55321) A masked secret's visible head/tail could carry control bytes (newline, NUL, DEL, C1 0x80-0x9F, zero-width) into config/status/dump output. Strip every control incl. \n/\t (display differs from redact_sensitive_text, which preserves \n/\t as line structure) before slicing; all-control values return the configured empty fallback. Consolidates the previously-closed NousResearch#58079 approach (strip controls before masking) - supersedes it. (cherry picked from commit e9d1551)
Summary
mask_secret()outputCloses #55319
Validation
python -m pytest tests\agent\test_redact.py -q -k MaskSecret --basetemp .pytest-tmp-mask-secret-controls-> 3 passedpython -m ruff check agent\redact.py tests\agent\test_redact.py-> passedpython -m pytest tests\agent\test_redact.py -q --basetemp .pytest-tmp-redact-full-> 125 passedgit diff --check-> cleanAgent transcript (redacted)
agent/redact.pyimplementation.