Repository navigation
fix(browser): pages reach SSRF-blocked addresses by navigating after an action's 250 ms guard - #198452
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: ready, awaiting a maintainer decision. What this changesThis PR keeps document interception active between browser actions and applies a tab-level destination policy without invocation-scoped grants. Example: A page navigates to http://localhost:18402/denied 500 ms after a key press under a policy allowing only 127.0.0.1.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision Keep this PR open: current main retains the reported bypass, and no discrete introduced bug was found; the standing policy still needs an owner decision. Priority: P0 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe bundled browser plugin translates Gateway browser operations into Playwright and CDP commands; its tab fence intercepts document requests and either continues or cancels them. flowchart TD
A[Gateway browser request] --> B[Resolved navigation policy]
B --> C[Tab document fence]
D[Chromium document request] --> C
C --> E[Active invocation policy]
C --> F[Standing tab policy]
E --> G[Continue or cancel request]
F --> G
Technical reviewBest possible solution: Keep document enforcement in the existing tab fence, with temporary invocation grants and an explicitly approved standing-policy contract. Do we have a high-confidence way to reproduce the issue? Current-main source shows the guard ending and Fetch interception being disabled; contributor-supplied real-Chromium and released-Gateway traces demonstrate the delayed request reaching the denied server, without executing target code during this review. Is this the best way to solve the issue? The smallest complete repair is to retain document interception in the existing tab owner and use configured policy between claims; this PR follows that design, preserves native CORS ownership, and explains its intentional policy changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 669576890a1f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +158, Tests +195, Docs +4. Total +357 across 16 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed November 14, 2026, 10:23 PM ET / November 15, 2026, 03:23 UTC (Revision 7). |
Every guarded navigation or action created its own CDP session for document interception and tore it down afterwards, so nothing owned a tab's interception between actions. The tab now owns the session and its frame targets. Each invocation registers a claim with its own policy, handler and failure state, and a paused document goes through the claims present when it arrived. Interception still runs only while a claim exists: the last release disables it and the next claim enables it again, so what is allowed or blocked does not change. Prepares the standing policy for openclaw#198317.
Document interception ended 250 ms after each browser action, so a page script that navigated later reached a policy-denied address and replaced the tab's document (openclaw#198317). Interception now stays on for the tab's lifetime. With no invocation claiming the tab, its standing policy decides each document: the configured policy without invocation-scoped grants such as the automatic loopback exception. A document from the origin the frame or tab is already on is allowed, since a page can fetch its own origin anyway. A denied navigation the page did not request (address bar, reload, back) shows the browser's blocked page; one a page script requested is cancelled and the tab keeps its page. A page can imitate a browser-initiated navigation, so that distinction only picks how the denial looks. Not covered: a popup's first request, service workers, fetch/XHR and other subresources, tabs never navigated or acted on, and the time OpenClaw's connection to the browser is down.
905647c to
a4b66c0
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
The same change as on the tab fence, applied where interception stays on between actions and a claim only starts document tracking: disposal returns after the release is acknowledged, the next claim starts after that, and a failed start fails the invocation.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
A tab's first claim sent Network.enable twice: once when its target was set up with a claim present, and again from the claim. A second invocation joining a claimed tab sent it again too. Each target is now started once per claimed period and every claim awaits that start; a release begins a new period. The standing policy takes the invocation's options itself, which keeps the fence file within its size limit. The dashboard navigation test holds each navigation attempt at its fence preparation. Interception stays on for the tab here, so that preparation is the claim's tracking start. Its session checks follow the tab-owned session: one session serves every attempt and is detached, with no listeners left, when the tab closes.
Resolves the conflicts with the merged tab fence (openclaw#198638) in pw-session-navigation-fence.ts and its test. Main holds the fence this branch was stacked on; this branch's side keeps interception on for the tab, starts only document tracking per claim and adds the standing policy. Main's catch on the paused-document handler is kept around both the claimed and the standing path.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…an action's 250 ms guard (openclaw#198452) * refactor(browser): keep one document-interception session per tab Every guarded navigation or action created its own CDP session for document interception and tore it down afterwards, so nothing owned a tab's interception between actions. The tab now owns the session and its frame targets. Each invocation registers a claim with its own policy, handler and failure state, and a paused document goes through the claims present when it arrived. Interception still runs only while a claim exists: the last release disables it and the next claim enables it again, so what is allowed or blocked does not change. Prepares the standing policy for openclaw#198317. * fix(browser): keep document navigation policy on tabs between actions Document interception ended 250 ms after each browser action, so a page script that navigated later reached a policy-denied address and replaced the tab's document (openclaw#198317). Interception now stays on for the tab's lifetime. With no invocation claiming the tab, its standing policy decides each document: the configured policy without invocation-scoped grants such as the automatic loopback exception. A document from the origin the frame or tab is already on is allowed, since a page can fetch its own origin anyway. A denied navigation the page did not request (address bar, reload, back) shows the browser's blocked page; one a page script requested is cancelled and the tab keeps its page. A page can imitate a browser-initiated navigation, so that distinction only picks how the denial looks. Not covered: a popup's first request, service workers, fetch/XHR and other subresources, tabs never navigated or acted on, and the time OpenClaw's connection to the browser is down. * fix(browser): wait for a tab's release before the next claim The same change as on the tab fence, applied where interception stays on between actions and a claim only starts document tracking: disposal returns after the release is acknowledged, the next claim starts after that, and a failed start fails the invocation. * fix(browser): fail a claim whose tab release is never answered The same bound as on the tab fence: a claim waits for the last release's answer no longer than the navigation timeout, then fails without starting document tracking over it. * fix(browser): let a claim that started nothing give up without cleanup The same change as on the tab fence: a claim that timed out waiting for the tab's release only drops its claim and fails at the navigation timeout, instead of running the cleanup of an action that never began. * fix(browser): start a tab's document tracking once per claimed period A tab's first claim sent Network.enable twice: once when its target was set up with a claim present, and again from the claim. A second invocation joining a claimed tab sent it again too. Each target is now started once per claimed period and every claim awaits that start; a release begins a new period. The standing policy takes the invocation's options itself, which keeps the fence file within its size limit. The dashboard navigation test holds each navigation attempt at its fence preparation. Interception stays on for the tab here, so that preparation is the claim's tracking start. Its session checks follow the tab-owned session: one session serves every attempt and is detached, with no listeners left, when the tab closes.
) Adapt the upstream standing document policy to the 11.4 Playwright owner. Keep configured policy distinct from invocation grants, drain captured claims, recheck live authority, and retire with the tab or connection. Baseline delayed-navigation leakage reproduced; four patched live scenarios passed. Independent source review found no actionable P0-P2 findings. Remaining local checks defer to fresh full release validation per operator instruction. (cherry picked from commit c8caba2) Co-authored-by: Daniel <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Backport the bounded navigation-fence group to release/2026.11.6. Retire ended Fetch interceptions without losing relay attachments, keep one document-interception session per tab, and propagate the configured standing policy without invocation-scoped loopback grants. Preserve release acknowledgments, navigation timeouts, and current-origin access. Source-commit: d3d8c1f Source-commit: 4c7f087 Source-commit: c8caba2 Co-authored-by: Josh Lehman <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 8ae5f6fa9c653eb82c13b9f5689bb38049bc2b88)
Native Chromium exposed a first-denial warning throwing while resolving a safe log directory. The unclaimed-document handler swallowed that exception before Fetch.failRequest, leaving navigation permanently paused. Keep the policy decision independent of best-effort diagnostics. Use Playwright commit observation for the blocked-page live assertion; the global Vitest expect.poll loses its test context on this CDP callback. The existing five-second assertion deadline is unchanged. Source-backport: c8caba2 Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 4237e403797c8cd52623379e7d8bcb8064ee1f41)
Closes #198317
Builds on #198638, which moved document interception from each invocation to the tab. This PR adds the standing policy on top of it: about 190 added source lines, most of them in the new
pw-session-navigation-standing.ts.What Problem This Solves
Fixes: a page reaches an address the browser SSRF policy blocks by navigating more than 250 ms after a browser action, because document interception ends when each action's guard window does.
User Impact
User impact: in a tab OpenClaw has navigated or acted on, a document the page requests between actions is checked against the configured
browser.ssrfPolicyand stopped before any request leaves the browser when the policy denies it.What someone using that browser notices:
Typing a blocked address into such a tab (or reloading or going back to one) shows Chrome's blocked page instead of loading it. To open it anyway, use a new tab or add the host to
browser.ssrfPolicy.allowedHostnames.A page keeps loading documents from the origin it is already on, so a localhost dev page opened under the automatic loopback exception can reload itself and follow its own links between tool calls. A different loopback port is a different origin and is stopped.
A blocked navigation that a page script requested is cancelled silently and the tab keeps its page.
Each document request in such a tab makes one round trip through the Gateway before it loads, between actions as well as during them.
Not covered, and listed in the docs: a popup's first request, Service Worker traffic,
fetch/XHR and other subresources, tabs OpenClaw has not navigated or acted on, the time the Gateway's connection to the browser is down (a tab is covered again from its next guarded action), and speculation-rules prefetch on browsers OpenClaw did not launch.Why This Change Was Made
pw-session-navigation-standing.ts; the fence itself changes by about 45 lines.Fetch.disable, so the extension relay's refusal ofFetch.enableduring a release, which refactor(browser): keep one document-interception session per tab #198638 handles, has no release to meet here. A claim only starts document tracking (Network.enable), after the last release is answered, once per target while the tab is claimed. It waits for that answer no longer than the navigation timeout, then fails without starting tracking; having started nothing, it only gives up its claim. A claim whose tracking fails to start fails its invocation.fetch()its own origin, so they reach nothing new.One tradeoff for reviewers: the same-origin allowance is checked ahead of
blockedHostnames. A tab already on a host that a config reload later blocks keeps loading that origin.mainenforces nothing between actions, so this is not a widening againstmain.Evidence
Reproduction: a real-Chromium test presses a key, and the page navigates to a denied address 500 ms later while a fixture server at that address counts requests. On
mainthe server receives the document and it becomes the tab's page. With this change it receives nothing and the tab keeps its page.Through a Gateway with a real agent and model, across an upgrade from v2026.11.3 (one run in a clean macOS VM, headed managed browser):
Setup: the Gateway of release
2026.11.3(from npm) runs withbrowser.ssrfPolicy: { dangerouslyAllowPrivateNetwork: false, allowedHostnames: ["127.0.0.1"] }. One turn throughopenclaw agentwith Claude Sonnet 5.5 has the agent use the browser tool to load a page, press a key, wait 3 seconds and take a snapshot. The page navigates to a policy-denied address 500 ms after the key press, and a fixture server at that address counts requests.On
2026.11.3: the denied server received the document and the tab ended on it.Upgrade: the Gateway is stopped, this PR's build runs
doctor --fixon the same state and config, and starts on them. The policy settings are the same before and after, and the browser profile that2026.11.3created is reused.Same turn on this PR's build: no request reached the denied server and the tab kept its page. The agent's reply: "pressing
asucceeded. The URL didn't change". The Gateway log hasStopped a document the page requested between browser actions.Manual navigation afterwards, typed into the real address bar of that upgraded profile's window:
The denied address in the tab the agent used: Chrome's blocked page (the screenshot under User Impact), no request reached the server.
An allowed address in the same tab loads:
The denied address in a tab OpenClaw never navigated or acted on loads, as the limits above say:
The model calls leave the VM through a forwarder that adds the API key outside it, so no key is in the VM. The prompt asks for
navigatein the existing tab, because2026.11.3refusedopenon a headed managed browser under this explicit strict policy.Through the production extension relay: real Chromium 156 with the bundled extension 2.3.0 loaded unpacked and paired with the Gateway's relay, in a clean macOS VM. The relay and the extension are unmodified; a tap on the relay's client socket in the test records each
Fetch/Networkenable and disable request and its answer. A fixture server at a policy-denied address counts requests.A key press makes the page navigate to the denied address 500 ms after the action returned: no request reached the server and the tab kept its page.
Back-to-back key-press actions on one tab, the second making the page navigate to the denied address, and a second action started at the moment the first action's release reached the relay: blocked in 6 of 6 rounds, no request reached the server.
Each tab gets one
Fetch.enableand noFetch.disable; between actions onlyNetwork.disableandNetwork.enablecross the relay, the enable after the disable is answered.Live tests (real Chromium over direct CDP): 34 pass: the between-actions suite (5), redirect authority (12), page-cancelled interception (3), download policy (7), current-document download (5) and native CORS (2). Three native-CORS cases need
127.0.0.2, which macOS does not route; they time out there onmainas well.Unit tests: 195 of 195 pass in the eight browser test files that cover the fence, its callers and the navigation guard, including a release answered late, a release never answered, a claim whose tracking fails to start, and the dashboard navigation test. That test holds each navigation attempt at its fence preparation, which on this branch is the claim's tracking start because interception stays on for the tab. Targeted typecheck, lint and format are clean.
Checked on a prior revision of this change with the same standing-policy logic, not rerun on this head:
blob:/data:/srcdocframes behaved between actions as on an unfenced tab.Not checked: Linux and Windows, and remote-CDP profiles.