Skip to content

fix(runtime): block click-driven navigation to internal URLs - #20

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-cf2d
Draft

fix(runtime): block click-driven navigation to internal URLs#20
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-cf2d

Conversation

@cursor

@cursor cursor Bot commented Aug 28, 2026

Copy link
Copy Markdown

Bug

After an allowed public navigate, click (and form submit via click) can send the page to http://127.0.0.1, file:, or other internal targets. snapshot then returns that document. PR #16 only guards explicit navigate and does not cover this path.

Trigger

  1. Agent navigates to an attacker-controlled public page with <a href="http://127.0.0.1:<victim>/secret">.
  2. Agent clicks that link.
  3. Agent snapshots. Internal HTML is returned in htmlSnippet / domSummary.

Live Chromium: public data: (or localtest.me) page, click to loopback, marker present in snapshot before this change; companion integration test now expects COMMAND_FAILED and no victim marker.

Fix

  • Shared URL policy in @webchain/protocol (assertAllowedNavigateUrl).
  • Playwright context.route aborts file/internal requests for the session (covers click, form submit, JS navigation).
  • After click/type, restore the prior page if the final URL is blocked.
  • snapshot refuses to read a blocked page and restores about:blank.

Distinct from #16 (schema + navigate() only). This PR does not change NavigateCommandSchema.

Validation

  • pnpm lint
  • pnpm --filter @webchain/protocol test:coverage
  • pnpm --filter @webchain/runtime test:coverage
  • pnpm --filter @webchain/companion test
  • pnpm --filter @webchain/companion test:integration (includes live Chromium click-to-loopback case)
  • typecheck on protocol, runtime, companion
Open in Web View Automation 

Click and type could leave the page on loopback or file targets after an
allowed public navigate, so a later snapshot leaked internal HTML.
Abort disallowed session requests and restore the prior page when the
final URL is blocked.

Co-authored-by: esadrianno <esadrianno@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant