Skip to content

feat(browser): add shared isolated CefRequestContext pool for previews and remote server partitions - #277

Merged
Hona merged 1 commit into
devfrom
ws1-phase3a
Nov 20, 2026
Merged

Hona merged 1 commit into
devfrom
ws1-phase3a

Conversation

@Hona

@Hona Hona commented Nov 20, 2026

Copy link
Copy Markdown
Member

Summary

Adds the shared isolated CefRequestContext pool (apps/browser-engine/src/context.rs) and per-server partition / remote proxy confinement (Phase 3a of UP-095 #63002, unblocking PREVIEWS Phase 2, WS-9 extension isolation, and BROWSER-TOOLS Phase 4 remote tunnels):

  • Shared ContextKind contract (wire.rs, protocol.rs): Additive #[serde(default)] context: ContextKind (Default | IsolatedPreview { grant } | RemoteServer { partition, proxy }) on HostMsg::OpenTab, plus HostMsg::SetPartitionProxy, HostMsg::DropContext, and Ready { partitions: true, remote_proxy: true }.
  • Strict ephemeral isolation (apps/browser-engine/src/context.rs): IsolatedPreview and RemoteServer tabs run in dedicated in-memory CefRequestContexts (cache_path: "", persist_session_cookies: 0) isolated from the user's persistent Default profile and from each other; RemoteServer tabs always drop file_roots.
  • Remote proxy confinement & zero-race startup: Restricts RemoteProxyConfig strictly to loopback hosts (browser.proxy.invalid fail-closed), configures Chromium's proxy preference (fixed_servers, bypass_list = "<-loopback>"), webrtc.ip_handling_policy = "disable_non_proxied_udp", dns_over_https.mode = "off", and net.quic_allowed = false, defers initial navigation on newly created proxied contexts until on_request_context_initialized finishes applying preferences (failing closed on failure), and answers auth_credentials(is_proxy == 1) strictly when (basic, host, port, realm) matches (network.ts:57-66).
  • Fail-closed host integration (crates/browser-pane, apps/desktop): Defers non-default tabs until Ready, refuses isolated/proxied opens on older engines lacking partitions/remote_proxy (browser.partitions.unsupported), uses per-server RemoteServer partitions for non-sidecar servers, and inherits RemoteServer context on pop-ups.

Verification

  • scripts/guardrails.ps1: 5/5 passed (0 files > 800 in desktop/features/crates, 0 dialog-size errors)
  • cargo clippy -p browser-pane --no-deps -- -D warnings, cargo check -p browser-pane --no-default-features, cargo check --workspace, scripts/web.ps1 -Check, and apps/browser-engine build: all passed with 0 warnings
  • Live CEF 156 IPC proof (9/9 scenarios): Ready { partitions: true, remote_proxy: true }, cookie/localStorage isolation across Default vs IsolatedPreview vs RemoteServer("srv-a") vs RemoteServer("srv-b"), loopback 127.0.0.1 traffic routed 100% through authenticated local proxy (<-loopback>, 0 direct hits, 0 user auth prompts), RemoteServer file:// refusal, non-loopback proxy fail-closed refusal, and clean DropContext teardown

…s and remote server partitions

Implements Phase 3a shared `CefRequestContext` isolation and remote proxy confinement
across `apps/browser-engine`, `crates/browser-pane`, and `apps/desktop` (unblocking
PREVIEWS Phase 2, WS-9 extension isolation, and BROWSER-TOOLS Phase 4 remote tunnels):

- **Shared context pool (`apps/browser-engine/src/context.rs`):** Adds `ContextKind`
  (`Default` | `IsolatedPreview { grant }` | `RemoteServer { partition, proxy }`) on
  `HostMsg::OpenTab` (additive `#[serde(default)]`), plus `HostMsg::SetPartitionProxy`,
  `HostMsg::DropContext`, and `EngineMsg::Ready { partitions: true, remote_proxy: true }`.
- **In-memory storage/cookie/extension isolation:** `IsolatedPreview` and `RemoteServer`
  contexts use empty `cache_path` + `persist_session_cookies: 0`, keeping cookies and
  localStorage isolated from `Default` and from each other (and invisible to extensions).
- **Remote proxy & network confinement:** Validates proxy endpoints to loopback hosts
  only (`browser.proxy.invalid` fail-closed), sets `proxy` preference to `fixed_servers`
  with `bypass_list = "<-loopback>"` (so loopback resolves on the remote server through
  the tunnel), `webrtc.ip_handling_policy = "disable_non_proxied_udp"`,
  `dns_over_https.mode = "off"`, and `net.quic_allowed = false`, deferring first-tab URL
  loads until `on_request_context_initialized` applies preferences (zero race window;
  fails closed if preference application fails). Handles `is_proxy == 1` Basic auth
  strictly for matching `(scheme, host, port, realm)` (`network.ts:57-66`), cancelling
  all other proxy auth challenges. Strips `file_roots` on `RemoteServer` tabs.
- **App fail-closed gating (`crates/browser-pane`, `apps/desktop`):** Holds non-default
  context tabs until `Ready`, refusing unsupported isolated/proxied contexts on older
  engines (`browser.partitions.unsupported`); routes remote-server tabs to per-server
  partitions and inherits opener `RemoteServer` context on pop-ups.
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR test build retired — merged into dev. Install or auto-update OpenCode (Rune) from https://anoma.ly/release/opencode/desktop-rune/dev/macos-arm64-dmg.

@Hona
Hona merged commit be1dd10 into dev Nov 20, 2026
7 checks passed
@Hona
Hona deleted the ws1-phase3a branch November 20, 2026 11:50
Hona added a commit that referenced this pull request Nov 20, 2026
…..UP-117 (#284)

- Fold verified fleet PRs #259, #267, #268, #269, #270, #271, #272, #273,
  #275, #276, #277, #279, and #282 (Rune e6deb869: #1297, #1298, #1299, #1300)
  into docs/upstream-sync/ledger.{json,md}
- Split UP-095 (#63002) transparently across active browser streams (WS-1,
  BROWSER-UI, PREVIEWS, BROWSER-TOOLS, WS-9), reassign UP-100 to BROWSER-UI
  and PRE-08 to BROWSER-TOOLS
- Track open tab-groups packaged-default regression on UP-062 (fix PR #278
  open) and record closure of Settings > Shortcuts hidden-command regression
  on UP-064 (#279)
- Audit upstream anomalyco/opencode 92d35f8e18..bfee96a859 (+11 commits:
  7 skipped, 4 added: UP-114..UP-117) and update radar routing
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
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