Repository navigation
Conversation
…verbatim `writeAuditEntry` wrote the joined args of every command to the on-disk JSONL audit log after truncation only, so `fill #password <value>`, `type <value>`, `cookie name=<value>` and `header Authorization: <value>` left the credential in a plain file in the daemon's cwd, and a page or Playwright error that echoed the value put a second copy in `error`. The activity stream's `filterArgs` never applied here: it works on the args array, and the audit entry receives one joined string. The value is now redacted in audit.ts itself, before truncation and before the line exists, for every command that carries a typed value: fill keeps its selector, type/js/dialog-accept are hidden whole, cookie and header keep their name, storage set keeps its key; everything after the kept part counts as the value, so a selector with spaces loses its tail too (more hidden, never less). The error text is scrubbed of the same value, whole and per 4+ character piece. Navigation and click lines are unchanged. Tests cover each command shape, the error scrub, redaction-before- truncation and the on-disk line; without the change the test file does not load (the exports do not exist). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Thanks for this. The leak is real. A maintainer lane is rewriting the fix on current main (our policy for outside code), crediting you with Co-authored-by for anything carried over. We'll link the landed PR here and close this one then. |
|
Thanks @derHaken. This was a real gap: the browse audit log stored |
Problem
browse/src/audit.tswrites every command's joined args to the on-disk JSONL audit log after truncation only. Afill #password <value>,type <value>,cookie name=<value>orheader Authorization: <value>therefore persists the credential verbatim in a plain file in the daemon's cwd, and a page or Playwright error that echoes the value stores a second copy inerror. The activity stream'sfilterArgsdoes not reach this path: it filters the args array for the sidebar, while the audit entry receives one joined string.Change
Redaction happens in
audit.tsitself, before truncation and before the line exists, for every command that carries a typed value:fill <selector> <value><selector> <redacted>type,js,dialog-accept<redacted>(whole)cookie name=value/header Name: valuename=<redacted>/Name:<redacted>(no separator: whole)storage set key valueset key <redacted>Everything after the kept part counts as the value, so a selector with spaces loses its tail too (more is hidden, never less). The error text is scrubbed of the same value, whole and per 4+ character piece. Navigation, click and other lines are unchanged.
REDACTED,redactArgsandscrubSecretare exported so the behaviour is testable and reusable.Tests
browse/test/audit-redact.test.ts: each command shape, the no-separator cases, the error scrub, redaction-before-truncation (a 500-charactertypevalue cannot leak its head), and the on-disk line via a temp log. Without the source change the test file does not load, since the exports do not exist.bun test browse/test/activity.test.ts browse/test/audit-redact.test.ts: 30 pass.Related surface, not changed here
activity.ts'sfilterArgs(the in-memory stream the sidebar reads) is narrower than this: it redacts afillvalue only when the selector looks like a password field (/password|passwd|secret|token/i), headers only forauthorization/x-api-key/cookie, and neverjs,dialog-acceptorstorage set. A fill into#pinorinput[name=pw]still streams its value. Happy to follow up with a shared redaction if you'd like the two paths unified.🤖 Generated with Claude Code