Skip to content

fix(browser): block interaction-triggered navigation SSRF - #104254

Merged
steipete merged 20 commits into
mainfrom
codex/fix-browser-interaction-ssrf
Jul 11, 2026
Merged

steipete merged 20 commits into
mainfrom
codex/fix-browser-interaction-ssrf

Conversation

@steipete

@steipete steipete commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #103783

What Problem This Solves

Browser interactions could trigger page-controlled navigation after the route's initial URL check. The first repair covered hover, drag, and scrollIntoView, but review found the same request-stage gap in click, coordinate click, select, press, type/submit, fill, form fill, and evaluate. A denied destination could therefore be attempted before the residual final-URL check, and multi-step actions could continue after cancellation.

Why This Change Was Made

The managed Playwright path now has one canonical, page-scoped interaction transaction for every navigation-capable action. It carries the complete browser policy, intercepts policy-denied document requests before HTTP request bytes are sent, preserves the source document with a synthetic 204, stops canceled multi-step actions before their next side effect, drains in-flight policy work, and retains final-URL reconciliation and quarantine.

Per-field form filling uses the same transaction and stops at the first policy denial. The route remains installed through the action and the bounded 250 ms post-action grace window, then removes only its own handler. Allowed actions, dialogs, downloads, and existing response shapes remain functional.

Generic waits remain outside this transaction because Playwright does not provide safe per-wait cancellation; retaining a stale route or tearing down the shared connection would cross later sibling-tab and agent work. Existing-session, extension, remote-CDP, redirect-hop, popup-first-request, Service Worker, background/subresource, and complete browser-egress guarantees remain explicitly out of scope for this bounded fix.

Fresh managed Chrome launches also best-effort disable network prediction as defense in depth. That preference is not the enforcement boundary and does not claim zero DNS, TCP, TLS, or QUIC contact.

User Impact

Allowed browser interactions keep working. If page code tries to navigate to a policy-denied destination during a guarded action, the agent receives the explicit browser navigation-policy error, the source tab remains usable, later action side effects do not run, and unrelated tabs are not intercepted.

Evidence

  • Exact PR head: a34b1f67b845347674009e223a0ff97b53da90b6.
  • Blacksmith Testbox through Crabbox tbx_01kx88zzhytas72a8s5tkh6v8b (pearl-crayfish): six focused browser files, 97 tests passed.
  • Same Testbox lease: full corepack pnpm check:changed passed every selected lane in 8m35s.
  • Fresh structured autoreview found one real canceled multi-step continuation bug; it was fixed. The required rerun was clean (patch is correct, confidence 0.91).
  • Exact-head hosted CI run 29148972157: all relevant jobs completed successfully with no failed or pending job.
  • Real local Gateway + OpenClaw-managed Google Chrome + OpenAI gpt-5.4 proof on the exact head:
    • 17 distinct Gateway agent runs in one session, with exactly 17 linked Browser calls: seven snapshots and ten actions covering click, coordinate click, select, press, type/submit, form fill, evaluate, hover, drag, and scrollIntoView;
    • all ten actions returned the exact browser navigation blocked by policy error;
    • all ten original targets remained open at about:blank, the same Chrome process and Gateway remained healthy, and no compensating/retry call occurred;
    • one nonce-bound canary instance stayed live before and after actions while all action lanes, unexpected requests, total attack requests, TCP accepts, and TCP bytes remained zero through terminal capture;
    • managed Chrome and all four listeners stopped, the temporary credential staging file was independently absent, a 385-file raw-state credential scan passed, and an allowlisted 40-file sanitized evidence export was generated.
  • A fresh source-blind validator independently recomputed all 39 manifest payload hashes and byte sizes and passed 9/9 behavior-contract clauses. Its first pass rejected the missing credential-staging cleanup evidence; the terminal probe was added, the complete 17-call scenario was rerun, and the new export passed cleanup and evidence hygiene.

@steipete
steipete requested a review from a team as a code owner July 11, 2026 06:58
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime security Security documentation size: XL maintainer Maintainer-authored PR labels Jul 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 219f99e6ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

throw err;
});
try {
return await awaitActionWithAbort(guardedAction, abortPromise, onActionResolvedAfterAbort);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Return policy denials without waiting for act timeout

When a guarded long-running action such as act:wait observes a policy-denied document request, onPolicyDenied only stores observedPolicyError; this await still races only the wrapped action and external abort. If the denied navigation is fulfilled with the synthetic 204 to preserve the source page, page.waitForURL/waitForLoadState can keep waiting until its per-call or default action timeout before the stored SSRF error is surfaced, so blocked navigations during waits can hang for ~60s instead of returning the policy failure promptly.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 6:20 AM ET / 10:20 UTC.

Summary
The PR adds request-stage SSRF guards around browser interaction-triggered document navigations, exposes scrollIntoView, disables speculative network prediction for fresh managed Chrome launches, and updates browser tests and security documentation.

PR surface: Source +441, Tests +1834, Docs +2. Total +2277 across 20 files.

Reproducibility: yes. The linked issue defines a concrete managed-Chrome interaction path, and the PR supplies live action-linked proof with zero contacts to a controlled denied listener.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: extensions/browser/src/browser/chrome.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #103783
Summary: This PR is the candidate fix for the canonical interaction-triggered SSRF issue; the two earlier merged PRs are adjacent defenses that established request interception and post-navigation checking.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] The protection is intentionally request-stage and page-scoped rather than a complete browser network firewall; redirect hops, a popup's first request, Service Worker traffic, page code after the bounded guard window, reused browser processes, and some background paths remain dependent on residual checks or external egress isolation.

Maintainer options:

  1. Accept the bounded boundary (recommended)
    Merge the reviewed request-stage protection while retaining its documented limitations and separate complete-enforcement follow-up.
  2. Pause for proxy architecture
    Hold the PR until a policy-enforcing proxy or equivalent owner-side isolation covers the remaining browser traffic classes.

Next step before merge

  • The code review is clean, but the protected security and maintainer labels require an explicit human decision on accepting the bounded security boundary and landing the PR.

Maintainer decision needed

  • Question: Should this bounded request-stage SSRF fix land now with the documented residual browser-routing gaps, or should merge wait for complete connect-time egress enforcement?
  • Rationale: The patch correctly closes the reported interaction gap, but accepting its explicitly incomplete browser-network boundary is a security-policy choice reserved for the protected security review path.
  • Likely owner: steipete — Recent current-main history shows the strongest ownership signal for this browser security boundary and its interaction guard design.
  • Options:
    • Accept bounded protection (recommended): Merge this reviewed interaction fix now and keep complete proxy-based enforcement as separate architecture work.
    • Require complete enforcement first: Pause the PR until redirects, popups, workers, reused sessions, and background traffic are governed at connect time.

Security
Cleared: The exact-head diff narrows the SSRF exposure without adding a concrete security or supply-chain regression, and its residual limitations are accurately documented.

Review details

Best possible solution:

Land the unified page-scoped interaction guard with its explicit bounded guarantee, and track complete connect-time enforcement separately as a lifecycle-owned policy proxy or owner-side egress-isolation design.

Do we have a high-confidence way to reproduce the issue?

Yes. The linked issue defines a concrete managed-Chrome interaction path, and the PR supplies live action-linked proof with zero contacts to a controlled denied listener.

Is this the best way to solve the issue?

Yes. A handler-specific page request guard shared by every navigation-capable interaction is the narrowest maintainable fix for this request-stage gap; complete browser egress isolation is correctly separated.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8d96790b4410.

Label changes

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR provides after-fix real Gateway and managed Chrome proof with linked browser calls, exact policy errors, preserved source tabs, zero canary contacts, runtime health, cleanup, and secret scanning.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P0: The PR closes a browser SSRF path that can allow page-influenced requests to operator-denied private or internal destinations.
  • merge-risk: 🚨 security-boundary: Merging establishes a deliberately bounded request-stage security boundary whose documented browser-routing gaps remain outside enforcement.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR provides after-fix real Gateway and managed Chrome proof with linked browser calls, exact policy errors, preserved source tabs, zero canary contacts, runtime health, cleanup, and secret scanning.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides after-fix real Gateway and managed Chrome proof with linked browser calls, exact policy errors, preserved source tabs, zero canary contacts, runtime health, cleanup, and secret scanning.
Evidence reviewed

PR surface:

Source +441, Tests +1834, Docs +2. Total +2277 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 9 902 461 +441
Tests 9 1878 44 +1834
Docs 2 4 2 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 20 2784 507 +2277

What I checked:

  • Unified request-stage guard: The final head installs a handler-specific page route, validates document requests under the resolved browser policy, uses a synthetic 204 for denied document loads when possible, removes only its own handler, drains in-flight checks, and gives policy denials precedence over action and cleanup errors. (extensions/browser/src/browser/pw-session.ts:1395, a34b1f67b845)
  • Prior P1 findings resolved: Compared with the previously reviewed head, the final commit routes click, coordinate click, press, type/submit, select, fill, evaluate, hover, drag, and scroll interactions through the shared request-stage guard and expands all-action regression coverage. (extensions/browser/src/browser/pw-tools-core.interactions.ts:120, a34b1f67b845)
  • Playwright dependency contract: The pinned Playwright 1.61.1 client supports handler-specific page.unroute and route.fallback chaining, while its documented routing gaps match the PR's bounded claims about redirects, popup first requests, and Service Workers. (extensions/browser/package.json:11, a34b1f67b845)
  • Live behavior proof: The PR discussion reports a real Gateway, OpenClaw-managed Chrome, and OpenAI-backed run where hover, drag, and scroll returned policy errors, source tabs remained usable, and the controlled denied listener observed zero TCP accepts, bytes, or HTTP requests. (a34b1f67b845)
  • Exact-head checks: GitHub reports successful exact-head real-behavior-proof, network SSRF CodeQL, security-sensitive guard, OpenGrep, and CI checks for the final SHA. (a34b1f67b845)
  • Feature provenance: Current-main blame and history tie the browser document-request classifier to recent Peter Steinberger work, while merged commits 462b402 and 5f5b3d7 established the adjacent request-interception and post-interaction guard behavior. (extensions/browser/src/browser/pw-session.ts:1233, bfffb537cee2)

Likely related people:

  • steipete: Current-main blame and recent merged history show the strongest ownership signal for the browser document-request classifier and interaction security path beyond authorship of this PR. (role: recent area contributor; confidence: high; commits: bfffb537cee2; files: extensions/browser/src/browser/pw-session.ts, extensions/browser/src/browser/pw-tools-core.interactions.ts)
  • eleqtrizit: Authored the merged post-interaction navigation hardening that established the neighboring guard and policy propagation path. (role: introduced adjacent behavior; confidence: high; commits: 5f5b3d733bdd; files: extensions/browser/src/browser/pw-tools-core.interactions.ts, extensions/browser/src/browser/routes/agent.act.ts)
  • pgondhi987: Authored the merged direct-navigation route interception that established request-stage SSRF enforcement in the Playwright session layer. (role: introduced request interception; confidence: high; commits: 462b4020bc41; files: extensions/browser/src/browser/pw-session.ts, extensions/browser/src/browser/pw-session.create-page.navigation-guard.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (4 earlier review cycles)
  • reviewed 2026-07-11T07:27:43.271Z sha 219f99e6ea16bb0297a9d92416330815219e6ea0 :: found issues before merge. :: [P2] Return policy denials without waiting for the action timeout
  • reviewed 2026-07-11T08:02:00.952Z sha 4bff004d3d3a1abe53ead24f8339078deac41f92 :: found issues before merge. :: [P2] Return policy denials without waiting for the action timeout
  • reviewed 2026-07-11T08:55:54.326Z sha d09a873e67d0b949dbfcc1b96f1ce2258078d32b :: found issues before merge. :: [P1] Guard click requests before the action navigates | [P1] Guard submit and key-driven navigations before dispatch
  • reviewed 2026-07-11T09:13:23.257Z sha 569055c :: found issues before merge. :: [P1] Guard click requests before the action navigates | [P1] Guard submit and key-driven navigations before dispatch

@steipete

Copy link
Copy Markdown
Contributor Author

Validation update for exact head 219f99e6ea16bb0297a9d92416330815219e6ea0:

  • Focused Crabbox run run_305cda3961e0: 271 tests passed across 12 browser test files.
  • Full Crabbox check:changed run run_257a28479efb: all selected core, core-test, extension, extension-test, and docs lanes passed.
  • Live proof: real Gateway, managed Google Chrome, and OpenAI gpt-5.4; six distinct agent runs produced six linked browser calls covering hover, drag, and scrollIntoView, with the expected policy denials.
  • Canary proof: nonce-bound, timestamped liveness probes before and after the actions reached the same listener instance. Separate attack counters remained at zero TCP accepts, zero TCP bytes, and zero requests before the run, immediately after the six calls, and at terminal cleanup.
  • All three source tabs remained at about:blank; the same Chrome process and Gateway remained healthy. Browser, Gateway, canary, and listener cleanup passed, as did the 365-file artifact secret scan.
  • Fresh autoreview found no actionable findings.
  • Fresh source-blind behavior validation passed all eight contract clauses, including call/result linkage, same-instance canary liveness, tab preservation, runtime health, cleanup, and evidence hygiene.

Scope remains intentionally bounded: request-stage policy interception prevents denied HTTP request bytes for these page-scoped Playwright actions. Fresh-launch Chrome network-prediction suppression is defense in depth. This does not claim complete enforcement for popup first requests, redirect hops, service workers or background traffic, DNS pinning, reused extension sessions, or other browser backends; complete connect-time enforcement still requires a policy-enforcing egress proxy.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call app: macos App: macos app: web-ui App: web-ui scripts Repository scripts commands Command implementations agents Agent runtime and tooling channel: feishu Channel integration: feishu extensions: codex plugin: google-meet plugin: file-transfer labels Jul 11, 2026
@steipete
steipete requested a review from a team as a code owner July 11, 2026 07:35
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 11, 2026
@github-actions

github-actions Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh /allow-dependencies-change comment after the guard blocks that new head SHA.

  • Current SHA: a34b1f67b845347674009e223a0ff97b53da90b6

@steipete
steipete force-pushed the codex/fix-browser-interaction-ssrf branch from d09a873 to 569055c Compare July 11, 2026 09:02
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jul 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a34b1f67b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

run: async ({ profileCtx, cdpUrl, tab, resolveTabUrl }) => {
const evaluateEnabled = ctx.state().resolved.evaluateEnabled;
const ssrfPolicy = ctx.state().resolved.ssrfPolicy;
const navigationPolicy = browserNavigationPolicyForProfile(ctx, profileCtx);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Forward proxy policy to upload hook clicks

When a managed profile is launched with explicit Chrome proxy args, this new browserNavigationPolicyForProfile wiring only covers /act; the file-chooser hook still calls pw.clickViaPlaywright with only ssrfPolicy in extensions/browser/src/browser/routes/agent.act.hooks.ts:113-118. In that hook's ref upload flow, clicking the upload control can trigger the same page navigation while browserProxyMode is missing, so assertBrowserNavigationAllowed does not fail closed for proxy-routed browser traffic before the request. Please pass the same resolved navigation policy through the hook-triggered click/upload path.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 11, 2026
@steipete
steipete merged commit 2d31996 into main Jul 11, 2026
124 of 131 checks passed
@steipete
steipete deleted the codex/fix-browser-interaction-ssrf branch July 11, 2026 11:30
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
…04254)

* fix(browser): guard interaction navigation requests

* fix(browser): preserve pages on blocked navigation

* fix(browser): enforce interaction navigation policy

* test(browser): type navigation guard fixtures

* fix(browser): execute guarded wait predicates

* style(browser): satisfy interaction lint

* fix(browser): guard hover drag and scroll navigation

* fix(browser): type policy check outcomes

* test(browser): type navigation guard mocks

* fix(browser): preserve proxy policy for guarded interactions

* fix(browser): carry navigation policy through actions

* fix(browser): retain policy for existing-session guards

* fix(browser): guard existing-session waits

* test(browser): avoid shadowed guard pages

* fix(browser): expose scroll action to agents

* fix(browser): disable speculative managed preconnects

* docs(browser): bound managed preconnect hardening

* fix(browser): keep wait behavior outside interaction guards

* chore(browser): leave release notes to release automation

* fix(browser): guard all interaction navigations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. security Security documentation size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Hover, drag, and scroll can bypass browser SSRF enforcement

1 participant