fix(runtime): redact password fields in page snapshots - #18
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
Playwright ariaSnapshot and page.content include input[type=password] values, leaking secrets into companion HTTP and MCP tool results. Co-authored-by: esadrianno <esadrianno@gmail.com>
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.
Bug and impact
BrowserRuntime.snapshotforwarded PlaywrightariaSnapshot()andpage.content()with no password redaction. Filledinput[type=password]values (and staticvalueattributes) appeared inaccessibilityTree/htmlSnippet, then in companion HTTP responses and MCP tool JSON, so secrets reached the agent context.Trigger: login form with
#pw type=password,typethe secret into#pw, thensnapshot. Live Chromium repro on this branch: typed secret was present in the ARIA tree before the fix and absent after. A staticvalueattribute leaked in HTML before the fix and is blanked after.Root cause
Playwright's ARIA serializer puts
element.valueinto the tree for password inputs. There is no in-API redaction option. Webchain captured the tree and HTML as-is.Fix
Blank matching password fields (type=password and autocomplete current/new/one-time-password) in the page before capture, restore them in
finallyso the live form stays usable.Validation
pnpm --filter @webchain/runtime testandtypecheck(29 tests). Helpers cover blank/restore and restore-on-throw.pnpm --filter @webchain/companion test:integrationwith Chromium. Login page served over loopback; typed and attribute secrets must not appear in the snapshot payload.