Repository navigation
fix(browser): require loopback proxy on RemoteServer, gate Navigate on proxy init, close tabs on proxy drop/failure, and block remote loopback external handoff - #292
Merged
Conversation
…n proxy init, close tabs on proxy drop/failure, and block remote loopback external handoff Addresses `notes/review-rd-engine.md` Finding 1 (and §7 proxy/drop/untrimmed-key, §3.5 password `Debug` redaction, §6 `oc-preview://` menu URL filter, §8 remote loopback external-open block, and Reader-9 empirical item #7): - **Refuse unproxied `RemoteServer` tabs fail-closed (`apps/browser-engine/src/context.rs`, `crates/browser-pane/src/{protocol,client,find}.rs`, `apps/desktop/src/surfaces/browser/mod.rs`):** Removes the `mode: "direct"` fallback for `RemoteServer` contexts. Both `BrowserHost` and `ContextPool` require a live authenticated loopback proxy (`browser.proxy.required` if absent; `RemoteServer` always requires `partitions && remote_proxy`). Caches `remote_proxies` on `BrowserHost` (supplied automatically by `default_browser_context()` and re-sent across engine reconnects) for BROWSER-TOOLS' `TunnelProxy` integration. - **Gate `HostMsg::Navigate` / history nav on `initialized && prefs_ok` (`context.rs`, `engine.rs`):** Closes the `about:blank` + immediate `HostMsg::Navigate` race window before `on_request_context_initialized` finishes applying `fixed_servers` + `<-loopback>` and required lockdown preferences (`webrtc.ip_handling_policy`, `net.quic_allowed`, `net.network_prediction_options`), failing closed if any required preference write returns `0`. Brackets IPv6 `::1` proxy hosts as `http://[::1]:<port>` and trims all pooled `ContextKey` strings canonically. - **Close live tabs on proxy failure, proxy clear, or `DropContext` (`engine.rs`):** Closes and refuses every live tab in a `RemoteServer` context if proxy initialization or `SetPartitionProxy` fails or clears (`proxy: None`), and closes all live tabs in a context before `DropContext` tears down the pool entry. - **Block remote loopback external handoff & redact proxy credentials (`surfaces/browser/ {mod,context_menu}.rs`, `menu.rs`, `wire.rs`, `protocol.rs`):** `external_url_allowed_for_tab` refuses loopback HTTP(S) URLs from remote-server tabs in both the page context menu and `open_browser_tab_externally`; removes arbitrary `oc-preview://` allow from `menu.rs`; redacts `RemoteProxyConfig::{username, password}` in `Debug`.
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
…18..UP-122 (#295) - Fold verified fleet PRs #278, #285, #287, #288, #289, #290, #291, and #293 (Rune dc8f7f72: #1301, #1302 focus rescue verified Send+Enter -> effort) into docs/upstream-sync/ledger.{json,md} - Close UP-062 packaged-default regression (#278), UP-095-UI / UP-100 / UP-106 / UP-109 / UP-117 (#285, #289), and PRE-08 (#287); reassign UP-115, UP-116, UP-075 to BROWSER-UI - Add separate Reviewed column for browser rows tracking retrospective security reviews on merged PRs (#245, #268, #272, #277, #288, #275, #287, #285, #289) and pre-merge holds (#274, #280, #281, #283, #286, #292, #294, and BROWSER-TOOLS PR 3+) - Audit upstream anomalyco/opencode bfee96a859..2002222d13 (+6 commits: 1 skipped, 5 added: UP-118..UP-122) and refine radar routing
|
PR test build retired — merged into |
…ext inheritance, pref readback, suspend/resume, loopback)
# Conflicts: # apps/browser-engine/src/context.rs
# Conflicts: # apps/browser-engine/src/context.rs # apps/browser-engine/src/engine.rs # apps/browser-engine/src/handlers.rs # apps/browser-engine/src/prompts.rs # apps/browser-engine/src/wire.rs # crates/browser-pane/src/protocol.rs
…enTab proxy sync, resume order, downloads gate, suspended UI)
…cel context menu callback
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
…egacy MCP until Unsupported/Unavailable, and fix #292 merge regressions
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
- Fold security-confirmed merged PRs #292 (6d7a6ed, WS-1 mandatory RemoteServer proxy), #294 (ae3e910, BROWSER-UI file-link/click-to-run fix with known symlink/junction root limitation), and #274 (5da6474, WS-9 engine MV3 extension host, inert without --extension flags) - Update browser Reviewed column: #301 in rework (#287 eager-attach time_updated regression still live on dev), #296/#298/#302/#303/#305/#306 in rework, #307 open for pre-merge security review - Audit upstream anomalyco/opencode fe8def6854..4122af0206 (+2 commits: 1 skipped #65255 core/codemode, 1 added UP-135 #65215 -> WS-8)
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
…hed servers and harden check_cdp (#296) * fix(browser): refuse local rune_mcp browser tools on remote/RPC-attached servers and block check_cdp contextId/userGesture * fix(web): gate browser rpc suppression check on wasm32 * fix(browser): gate native scope.rs on MCP suppression, track per-window sticky suppression, and harden CdpCall/check_cdp * refactor(browser-policy): extract check_cdp into cdp.rs to stay under 800-line ceiling * fix(browser): close scope.rs task.spawn/NormalizeUrl escape and keep Blocked::Replaced suppressed * refactor(browser-pane): move send_cdp into find.rs to stay under 1500-line ceiling * fix(browser): gate all non-builtin plugins in scope.rs, fail closed legacy MCP until Unsupported/Unavailable, and fix #292 merge regressions * fix(browser): verify Tier::Bundled on Half and add sticky legacy MCP capability probe
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
… and ban raw file:// unconditionally (#303) * fix(browser): refuse local rune_mcp browser tools on remote/RPC-attached servers and block check_cdp contextId/userGesture * fix(web): gate browser rpc suppression check on wasm32 * fix(browser): gate native scope.rs on MCP suppression, track per-window sticky suppression, and harden CdpCall/check_cdp * refactor(browser-policy): extract check_cdp into cdp.rs to stay under 800-line ceiling * feat(browser): route local, remote, and artifact previews via oc-preview:// and ban raw file:// unconditionally * fix(browser): close review-rd281 PR 2 blockers 1, 3, 4 and polish (third-party plugin ban, bounded PreviewFetch pool + abort + backpressure + exact skip, Connecting/zero-OpenTab older-engine fix) * fix(browser): close scope.rs task.spawn/NormalizeUrl escape and keep Blocked::Replaced suppressed * refactor(browser-pane): move send_cdp into find.rs to stay under 1500-line ceiling * fix(browser): tighten builtin running check, third-party link pre-filter, per-read timeout, and short-EOF skip guard * fix(browser): gate all non-builtin plugins in scope.rs, fail closed legacy MCP until Unsupported/Unavailable, and fix #292 merge regressions * fix(browser-engine): slice ranged 200 responses into exact 206/416 streams for CEF StreamReaderURLLoader * fix(browser): verify Tier::Bundled on Half and add sticky legacy MCP capability probe * fix(browser): close review-rd281 2nd-read findings (unbounded control events + PreviewCredit flow control, tool-scoped open_file/Links:Open agent gating, fair PreviewFetchPool + abortable DNS timeout) * fix(browser): close review-rd281 3rd-read findings (bounded 20s credit wait + Ready.preview_credit handshake, ranged-200 completion cancel/remove, EINTR + ascii-digit Content-Length)
Hona
added a commit
that referenced
this pull request
Nov 20, 2026
…extId, fix wait spin, and bound payloads/cancel (#298) * fix(browser): refuse local rune_mcp browser tools on remote/RPC-attached servers and block check_cdp contextId/userGesture * fix(browser): enforce RPC target/generation auth, track OOPIF frames & pinned contextId, fix wait deadline spin, and bound payloads/cancel * fix(web): gate browser rpc suppression check on wasm32 * fix(browser): exclude ContextKind::Private tabs from experimental.browser agent RPC inventory and tab resolution * fix(browser): gate native scope.rs on MCP suppression, track per-window sticky suppression, and harden CdpCall/check_cdp * fix(browser): verify TypedCdpCall ledger in engine, fail closed on unpinned context/256-frame overflow, recheck post-capture auth, and fix OOPIF/cancel/bounds * refactor(browser-policy): extract check_cdp into cdp.rs to stay under 800-line ceiling * refactor(browser-engine): extract CdpCall validation helper into cdp_ledger.rs to stay under 1500-line ceiling * fix(browser): retry tab CDP bootstrap after isolated context finishes initializing * fix(browser): close scope.rs task.spawn/NormalizeUrl escape and keep Blocked::Replaced suppressed * refactor(browser-pane): move send_cdp into find.rs to stay under 1500-line ceiling * fix(browser): gate all non-builtin plugins in scope.rs, fail closed legacy MCP until Unsupported/Unavailable, and fix #292 merge regressions * fix(browser): verify Tier::Bundled on Half and add sticky legacy MCP capability probe * fix(browser): close #298 Round-2 findings (fail-closed frameID, OOPIF subframe enumeration, WHATWG target URL, required contextId, bounded CdpResponse IPC) * fix(browser): preserve committed OOPIF child URLs across ancestor Page.getFrameTree stubs and fix BrowserRpcState field visibility * fix(browser): use url crate for WHATWG URLs, rebuild frames on getFrameTree, remove dup flush, depth-1 CDP scan * fix(browser): refresh OOPIF frame trees in browser.frames * fix(browser): verify live Page.getFrameTree before/after frame commands and drop >16 MiB CDP events pre-parse * chore(browser-engine): remove unused Value import from handlers.rs after verbatim move
Hona
added a commit
that referenced
this pull request
Nov 21, 2026
…ion (#302) * fix(browser): refuse local rune_mcp browser tools on remote/RPC-attached servers and block check_cdp contextId/userGesture * fix(browser): enforce RPC target/generation auth, track OOPIF frames & pinned contextId, fix wait deadline spin, and bound payloads/cancel * fix(web): gate browser rpc suppression check on wasm32 * fix(browser): exclude ContextKind::Private tabs from experimental.browser agent RPC inventory and tab resolution * fix(browser): harden TunnelProxy HTTP/1.1 framing, wire remote tunnel proxy to SetPartitionProxy, and add BuiltinPromptGate * fix(browser): gate native scope.rs on MCP suppression, track per-window sticky suppression, and harden CdpCall/check_cdp * fix(browser): verify TypedCdpCall ledger in engine, fail closed on unpinned context/256-frame overflow, recheck post-capture auth, and fix OOPIF/cancel/bounds * fix(browser): expand loopback_host IPv4/IPv6/alternate-encoding detection * refactor(browser-policy): move loopback_host helpers into agent.rs to stay under 800-line ceiling * fix(browser): clean FIN shutdown after 503 Service Unavailable on TunnelProxy concurrency cap * fix(browser): fail closed in engine ContextPool for RemoteServer, atomic tunnel rotation/suspend, host proxy validation, and Luau loopback_host * refactor(browser-policy): extract check_cdp into cdp.rs to stay under 800-line ceiling * refactor(browser-engine): extract CdpCall validation helper into cdp_ledger.rs to stay under 1500-line ceiling * fix(browser): retry tab CDP bootstrap after isolated context finishes initializing * fix(browser): check suspended state in ConnGuard::track_abort and bidirectional EOF path * fix(browser): close scope.rs task.spawn/NormalizeUrl escape and keep Blocked::Replaced suppressed * refactor(browser-pane): move send_cdp into find.rs to stay under 1500-line ceiling * fix(browser): gate all non-builtin plugins in scope.rs, fail closed legacy MCP until Unsupported/Unavailable, and fix #292 merge regressions * fix(browser): verify Tier::Bundled on Half and add sticky legacy MCP capability probe * fix(browser): close #298 Round-2 findings (fail-closed frameID, OOPIF subframe enumeration, WHATWG target URL, required contextId, bounded CdpResponse IPC) * fix(browser): preserve committed OOPIF child URLs across ancestor Page.getFrameTree stubs and fix BrowserRpcState field visibility * fix(browser): close #302 tunnel smuggling/DoS/SSE-suspend findings and port complete BuiltinPromptGate * fix(browser): use url crate for WHATWG URLs, rebuild frames on getFrameTree, remove dup flush, depth-1 CDP scan * fix(browser): refresh OOPIF frame trees in browser.frames * fix(browser): split prompt gate out of #302 and add tunnel watchdog + unauth pool isolation * fix(browser): verify live Page.getFrameTree before/after frame commands and drop >16 MiB CDP events pre-parse * fix(browser): remove authenticated tunnel idle kills, match 64-slot unauth pool with 3s head deadline + 1s watchdog margin * chore(browser-engine): remove unused Value import from handlers.rs after verbatim move
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.
Summary
Closes
notes/review-rd-engine.mdFinding 1 (remote-server proxy fail-closed enforcement, pre-init gating, preference read-back verification, and external loopback handoff blocking) plus all round-1 (0a539feb) and round-2 (5785b7f5) READER-9 findings — and explicitly folds in the Finding 2 context-inheritance and persistence-exclusion fixes (TabSnapshot.context, session/opener context derivation across pop-ups / blocked-popup Open / context-menu Open link & image,TabClosedpending_opens/session_tabs/strip pruning, and excluding isolated tabs fromsavedTabs,closedTab, andsite_zoom) per orchestrator approval.Reconciled with
origin/dev5d50c6f7(#299NoopCompletion+#281oc-preview://readiness gate): keeps#281's exact fail-closed readiness gate (ContextPool::is_tab_ready,default_tabs,generationtokens,PreInitBlockResourceHandler, sharedcontext_readyacrossTabRequestHandler/TabResourceRequestHandler/TabLifeSpanHandler/TabDownloadHandler,ContextHooks::on_initialized,clear_pending_load) and makesRemoteServertabs use it (ready = initialized && prefs_ok && !suspended, so a remote tab is ready ONLY when initialized, preferences are verified via read-back, AND its loopback proxy is live).Round-2 Delta Response (
5785b7f5 -> 5badf27a)5badf27aPrivatebrowser_context_for_opener(apps/desktop/src/surfaces/browser/mod.rs) to returnOption<(bool, ContextKind)>(Nonewhen opener is gone — never downgrades to directPrivate);poll_browser(PopupOpen) andprompts/view.rs(blocked pop-up Open) drop/refuse whenNone.context_menu.rscaptures(agent, ctx),sid, andexternal_link_okwhen opening the menu, cancels menus on suspended tabs, refuses"open-link"/"open-image"if the opener closed or itsRemoteServerlacks a live proxy, and re-resolves live proxy credentials before opening.OpenTabproxy rotation leaves staleprompts.proxy/contexton existing tabsContextPool::resolve_with_hooksreturnsproxy_updated: Option<(server_id, new_cfg, activate_ready)>;engine.rs::open_tabsyncst.contextandt.prompts.proxyacross ALL matchingRemoteServertabs before flippingready = true.TabDownloadHandlergapset_partition_proxyandresolve_with_hooksflipready = falseBEFOREapply_context_prefs->close_connections-> returnactivate_ready, andengine.rssyncst.context+t.prompts.proxyacross all matching tabs BEFORE flippingready = trueLAST. Passedcontext_ready: Arc<AtomicBool>toTabDownloadHandler(downloads.rs) blockingcan_download,on_before_download, andon_download_updated(removing partial files) while!ready(preventsblob:/data:disk writes while suspended).plugins/browser/locales/en.json:refused.proxyRequired"Paused while reconnecting to the server.",refused.proxyInvalid"Couldn't connect through the server's proxy.";crates/opencode-i18n/locales/rune/en.json:rune.browser.proxy.closed"Closed this tab because the server's browser proxy stopped working."), mapped infailure.luau, setsuspended = tab:Refusal() == "browser.proxy.required"ininit.luau, cleared"browser.proxy.required"refusal on resume infind.rs::set_partition_proxyandresolve_remote_context(triggeringBrowser.Changed->syncRefusalclear), toastedrune.browser.proxy.closedONLY on fatalbrowser.proxy.invalid/browser.context.unavailableclosures (zero toast on explicitDropContextof a suspended tab). Also fixedpanel.luau:425(env.reachable(url, tab)), setdeferred_initialon queuedNavigate(engine.rs), and clearedhas_engine_tabon unconfirmed engineOpenTabrefusals (engine_confirmedinclient.rs).(Zero tests added/edited; zero
.github/edits;preview/,prompts.rs,menu.rs,favicon.rsremain clean vs#2815d50c6f7.)Verification
pwsh -NoProfile -File scripts/guardrails.ps1: 5/5 passed (client.rs1490,engine.rs1391, 0 errors)cargo build --locked --manifest-path apps/browser-engine/Cargo.toml --bins: clean (0 warnings)cargo check --workspace: clean (0 warnings)cargo check -p browser-pane --no-default-features: clean (0 warnings)scripts/web.ps1 -Check: clean (0 warnings; 1038 files, no std::time)proof/ws1/fix1-remote-proxy.md,OPENCODE_RUNE_OTEL=0, scratch profiles):localhost-hostname / credential-lessRemoteServeropens all refused (browser.proxy.required/browser.proxy.invalid), 0 browsers opened.OpenTab("about:blank")+ immediateCdpCall+Navigate:CdpCallrejected (browser.proxy.required), 0 direct origin hits, nav routed viap1.SetPartitionProxy(None)->OpenTabTab 11 rotating top2:closedDuringSuspend: false, suspendedCdpCall/Navigateblocked,blobDownloadsWhileSuspended: 0,window.__unsaved === "keep-me-42"preserved, Tab 10 synced top2and routed/after-resumeviap2with 0407failures.stun:127.0.0.1:<udpPort>: RemoteServer =0UDP packets,0ICE candidates (Default control =3UDP packets,1ICE candidate).turn:127.0.0.1:<tcpPort>?transport=tcp,turns:127.0.0.1:<tcpPort>?transport=tcp,turn:probe-turn-host.invalid:443?transport=tcp: RemoteServer =0direct TCP hits (routed via proxyCONNECT 127.0.0.1:<tcpPort>andCONNECT probe-turn-host.invalid:443; Default control =3direct TCP hits).stun:probe-webrtc-dns.invalid:3478: RemoteServer =0STUN host lookup errors (Default control =2+.localmDNS host candidate).[::1]proxy routed cleanly; explicitDropContextclosed tab cleanly; reconciled#281oc-preview://local preview + pre-initCdpCallrejection verified live.Round-3 Delta Response (
5badf27a -> a8a105b5)a8a105b5Downloads.fileskeyed only by per-contextitem.id()(cross-context file deletion + stuck Pending)Downloads.filesby(u64, u32)=(self.tab_id, item.id())acrossapps/browser-engine/src/downloads.rs(:44, 64, 132, 150, 161, 177, 183) and emittedDownloadState::Failed { error: Some("canceled") }when cancelling a pending entry on!context_ready(:164-168).return;incontext_menu.rsleaks heldRunContextMenuCallbackreturn;onproxy.is_none()in"open-link"and"open-image"(apps/desktop/src/surfaces/browser/context_menu.rs:145-199) withif proxy_ok { ... }sorun_context_menu_action(tab_id, menu_id, engine_cmd)always executes and cancels CEF's callback.C:\tmp\opencode\ws1\prove-fix1-r4.ts,proof/ws1/fix1-remote-proxy.md§4):DefaultTab 1 (item.id() == 1,default-keep.txt) +RemoteServerTab 10 (item.id() == 1, slowremote-slow.bin) suspended mid-download: Tab 10 emittedstate: "failed", error: "canceled"and deleted its partial file, while Tab 1'sdefault-keep.txtsurvived intact on disk.RemoteServerTab 10 losing its proxy cancelled cleanly (menu1Id: 1->action: null-> reconnect ->menu2Id: 2opened cleanly).New i18n Keys (English only, ready for locale sync word)
plugins/browser/locales/en.json:refused.proxyRequired,refused.proxyInvalidcrates/opencode-i18n/locales/rune/en.json:rune.browser.proxy.closedHeld non-draft awaiting READER-9 confirmation before merge (do not self-merge).