Repository navigation
browse: redact typed values from the audit and dialog logs (GST-1631) - #4073
Merged
Merged
Conversation
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
Review-Finding: p1/specialist-batched#1 reader=security Review-Finding: p1/red-team#4 reader=red-team Review-Finding: p1/red-team#2 reader=red-team Review-Finding: p1/red-team#3 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: v2/outside-voice#1 reader=outside-voice Review-Finding: v2/adversarial-native#1 reader=adversarial-native Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: fc/fix-check#1 reader=fix-check Review-Finding: fc/fix-check#2 reader=fix-check Review-Finding: fc/fix-check#3 reader=fix-check Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
.gstack/browse-audit.jsonlstored each command's arguments verbatim, so typed credentials reached a plain file on disk. Every value-carrying command now logs[REDACTED]in place of the value, before the 200-character cut and before the line is written:fill #password hunter2#password hunter2#password [REDACTED]type --selector #pw -- text--selector #pw -- text--selector #pw -- [REDACTED]js <expr> --out f --raw<expr> --out f --raw[REDACTED] --out f --rawdialog-accept <text><text>[REDACTED]cookie sid=abcsid=abcsid=[REDACTED](no=: whole)header Authorization: Bearer tAuthorization: Bearer tAuthorization:[REDACTED](quoted or split into words; no:: whole)storage set token vset token vset token [REDACTED]skill run login --arg password=p… password=p… --arg password=[REDACTED]tab-each fill #otp 1234fill #otp 1234fill #otp [REDACTED]chain '[["fill","#pw","x"]]'/'… | fill #pw x'fill(real command names only, unknown names[REDACTED], never args); each step still writes its own per-command-redacted lineNavigation, click, select and every other command log as before. The
errorfield is scrubbed of the same values (the whole value, its JSON-escaped form, and each 4+ character word of it) before its 300-character cut, so a Playwright or page error that echoes the value no longer stores a second copy.browse-dialog.loghad the same bug: the flush wrote thedialog-acceptprompt answer verbatim. It now writes→ accepted "[REDACTED]"(formatDialogLogLineinbuffers.ts).Why
Secrets on disk (S2). The activity stream's
filterArgsnever covered this path. It filters the args array for the sidebar, while the audit entry got one joined string.writeAuditEntrynow takes the args array, so the fill selector and the chain JSON are split exactly.Blast radius
browse/src/audit.ts:AuditEntry.argsis nowstring[];redactCommandArgsandscrubSecretsare new exports. The only caller isserver.ts(two sites).audit.tsnow importsALL_COMMANDSandcanonicalizeCommandfromcommands.ts;commands.tsandmeta-commands.tsare unchanged from main. The on-diskargsfield is still a string.browse/src/server.ts: passesargsunjoined; the dialog flush usesformatDialogLogLine.Checked and not changed (different bug or not persisted):
browse-network.logrecords method, URL, status, duration and size only; no request headers are stored, so aheadervalue never reaches it. Page-issued URLs with token query params do reach it (page-originated, not typed).browse-console.logholds page console text (page-originated).activity.ts) is an in-memory ring buffer plus SSE, never written to disk; itsfilterArgsis narrower than this (fill only for password-like selectors, nojs/dialog-accept/storage set).network-captureexportToFilewrites headers and bodies only on an explicit export to a path the caller picks.cdp: the allowlist has no input, cookie, header or evaluate methods, so its params carry no typed secret.Tests
browse/test/audit-redaction.test.ts(first commit's cases; 35 at a87fbf6) driveswriteAuditEntryinto a temp log and reads the on-disk line: each command shape above, the no-separator cases, tab-each and chain (JSON and pipe form), unchanged navigation/click/select, redaction before truncation (long fill value, long chain), the error scrub (echoed value, multi-word and JSON-escaped value, nested chain/tab-each, a value straddling the 300-char cut), and the dialog log line. On main at 1a06afd, 19 of the 20 audit cases fail (the value-free error control passes; the navigation control fails there only because main'sargswas a string) and the dialog cases fail to load. Every case passes on this branch.Credit: the leak was reported, with a first patch, in #4057 by @derHaken. This is an independent rewrite on current main; no lines were carried over.
The grant fix's new cases fail at 95301ea and pass at a87fbf6.
Approvals
Approved: yes (record r-185be1ddb813). The full approval record stays private: this repository is public or its visibility is unknown.
Security fix assigned by GStack Minder (GST-1631); merge under the crew's standing
merge: directapproval. The owner granted one fix round past the review cap, and ruled the two outside-voice findings below as disclosed notes.Summary
Typed credentials stopped reaching
browse-audit.jsonlandbrowse-dialog.log. The last commit makes the chain audit line hold only real command names, so a malformed or unknown step can no longer carry a value onto disk; every step still writes its own redacted line.Test Coverage
All new code paths have test coverage: each of the 3 changed runtime files has a changed test naming it (deterministic coverage map, no audit reader).
Tests ran: targeted 189
Tests ran: typecheck count unavailable
Tests ran: typecheck-test count unavailable
CI carry: free-tests run 42241154222 at tree f3acb598 (dispatched on this branch after the base moved).
Pre-Landing Review
Full-depth security review at a87fbf6 (the granted fix round's fix-check): the batched specialist (testing, security, state-machines), the red team and the core checklist found nothing. Step 11's native adversarial voice raised 6 low findings, all below the floor. The outside voice (openai/gpt-6.1-sol) raised 2 findings marked blocking; both reproduced, and the owner ruled both disclosed notes:
Ruled note: browse/src/audit.ts:190:origin-url-verbatim at a87fbf6 ruled by Captain GStack Minder (GSTA-36), 2026-11-06 at 2026-11-06T15:07:28.470Z: p1/outside-voice#1: audit origin stores the full page URL; predates this PR (main has the same field), tracked as GST-1635 (approval a-3320e11ca492)
Ruled note: browse/src/audit.ts:153:short-piece-scrub at a87fbf6 ruled by Captain GStack Minder (GSTA-36), 2026-11-06 at 2026-11-06T15:07:29.086Z: p1/outside-voice#2: error scrub skips value pieces under 4 chars; strictly better than main, fix folded into GST-1635 (approval a-06f4b6613e12)
REVIEW_LOOP: passes=1 blocking_found=2 deferred=0 noted=8 fixed=0 scope=frozen ledgers_read=2 fix_checks=1 dispatches=4
Gate edits: none detected (1 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: completed (openai/gpt-6.1-sol through a host subagent, certified configuration); 2 findings, both ruled notes above.
Review notes
originfield is the fullpage.url(), so a value a page moves into its URL (a GET form, for example) reaches disk. Same field on main; tracked as GST-1635.jsexpression can survive in the error text. Main stored the whole expression; fix folded into GST-1635.scrubSecretscost grows with needle count times error length; a stall needs a very large agent-supplied expression.storage set key,fill #pw), losing forensic detail, not leaking.Exploratory QA
Functional, bounded smoke (ship Step 9.2.1) at a87fbf6, driving
writeAuditEntryinto an owned temp log: the success path (fill, type, js, cookie, header, storage set, dialog-accept, skill run, goto, and the dialog log line) and the riskiest changed edge (chain in pipe and JSON form with the earlier fix-check leak inputs, unspaced and quoted pipes, unknown names, tab-each nesting) both passed with no value on disk. One early capture was superseded because the probe itself put the value into a synthetic error. Not covered locally: the live daemon, which needs Chromium; CI ran commands.test.ts and content-security.test.ts.Design Review
No frontend files changed — design review skipped.
Eval Results
No prompt-related files changed — evals skipped.
Review bot comments
No review bot comments.
Scope Drift
Scope Check: CLEAN
Plan Completion
Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). Fix: add "Plan: " to the PR body, or run /autoplan.
Issues
Refs fc/fix-check#1
Refs fc/fix-check#2
Refs fc/fix-check#3
Refs p1/red-team#2
Refs p1/red-team#3
Refs p1/red-team#4
Refs p1/specialist-batched#1
Refs v2/adversarial-native#1
Refs v2/outside-voice#1
Verification Results
No plan-specific verification items (no plan bound); automatic diff-scoped QA ran as above.
TODOS
No TODO items completed in this PR.
Documentation
Scope: the committed diff from 1a06afd to a87fbf6 (browse audit/dialog log redaction, 5 files), checked against every .md and .tmpl file that mentions browse-audit, browse-dialog or the audit log. Mode: edit. Result: current. No documentation describes the content of the audit or dialog logs, so none contradicts the redaction. The changelog fragment already documents the behavior and the cleanup step for old logs. Debt: none found; a future note in BROWSER.md about redacted audit args would be optional.
Test plan
bun test browse/test/audit-redaction.test.ts browse/test/tab-each.test.ts browse/test/security-audit-r2.test.ts browse/test/activity.test.ts browse/test/server-factory.test.ts browse/test/config.test.ts test/module-size-ratchet.test.ts: exit 0, tests_ran=189bun run typecheck: exit 0bun run typecheck:test: exit 0🤖 Generated with Claude Code