Skip to content

feat(browser): add CEF popup, permission, JS dialog, HTTP auth, client-cert, and file-chooser handlers - #268

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

Hona merged 1 commit into
devfrom
ws1-phase1b

Conversation

@Hona

@Hona Hona commented Nov 20, 2026

Copy link
Copy Markdown
Member

Summary

Adds CEF Phase 1b prompt, pop-up, permission, HTTP auth, client-certificate, and agent file-chooser handlers across apps/browser-engine, crates/browser-pane, and apps/desktop (progressing #63002 / UP-095, closing #65091 / UP-112, and closing review-browser-policy.md §6–§7):

  • Pop-ups & middle-click links (LifeSpanHandler, on_open_urlfrom_tab): Unconditionally cancels unmanaged CEF native popup windows (on_before_popup always returns 1); refuses file://, credentialed, and non-HTTP(S) pop-ups; routes user-activated pop-ups and middle-clicked links to managed tabs in the opener's session (inheriting agent_driven); holds non-user-gesture pop-ups in a 500 ms guarded "Pop-up blocked" strip.
  • Site permissions (PermissionHandler): Immediately denies unknown permissions, desktop capture, cross-origin frames, insecure origins, and older-app connections (so clipboard-read / geolocation / notifications / media never hang); queues and coalesces {camera, microphone, location, notifications, clipboard-read} requests so every CEF callback settles once; persists profile decisions in plugin.browser/rune.sitePermissions while ensuring agent-driven tabs never inherit kept allows and auto-deny after 20 s; resets visit state and settles pending callbacks on origin change.
  • JS dialogs (JsdialogHandler): Holds alert/confirm/prompt/beforeunload when Hello.prompts is advertised (auto-skipping beforeunload on agent-driven tabs and suppressing scripted dialogs for older apps without native OS dialogs); renders pane-scoped alertdialog overlay with 500 ms activation delay, 1 s repeat-dialog suppression toggle, scrollable 160 px page text, bidi/control sanitization, card-level focus trap + MODAL-band key isolation (F6/Mod+L escape hatch, window chords passed through, key repeats ignored), and immediate [browser.dialog_open] / [browser.dialog_interrupted] handling (leaving Page.handleJavaScriptDialog open).
  • HTTP auth & client certificates (RequestHandler): Cancels all client certificate requests (select(None)); limits HTTP 401 auth (Basic/Digest/NTLM/Negotiate) to same-origin top-level http(s) challenges (clearing pending_top_url on load end/error/stop and updating on main-frame redirects; 3-attempt cap, queued/coalesced, retry error alert, immediate credential clearing); cancels immediately on agent-driven tabs (AuthAgentRequired).
  • Agent file choosers (DialogHandler): Cancels native file choosers on agent-driven tabs (FileChooserBlocked) and marks MCP-driven tabs as agent_driven.

Verification

  • scripts/guardrails.ps1: 5/5 passed (0 files >800 in desktop/features/crates, 0 dialog-size errors)
  • cargo check --workspace, cargo check -p browser-pane --no-default-features, cargo clippy -p browser-pane --no-deps -- -D warnings, scripts/web.ps1 -Check (wasm32-unknown-unknown + web-clock), and apps/browser-engine build: all passed with 0 warnings
  • Live CEF 156 IPC proof (12/12 scenarios): capabilities handshake, non-gesture pop-up block, credentialed pop-up refusal, user-gesture foreground pop-up, middle-click background tab, JS prompt round-trip, clipboard-read deny without hang, agent file-chooser block, stale pending_top_url cross-origin 204/401 check, human vs agent HTTP 401 auth, human vs agent beforeunload, and older-app prompts: false suppression
  • Live opencode-desktop + CEF 156 captures (light & dark at 1x) verifying permission bar, JS prompt modal, HTTP auth modal, and blocked pop-up strip against official e51247f626

…t-cert, and file-chooser handlers

Implements Phase 1b CEF browser handlers, queued/coalesced explicit `browser-pane`
state machines, and native Rune in-pane prompt overlays with modal key isolation
(progressing `UP-095` `#63002` and closing `UP-112` `#65091` middle-click managed tabs):

- **Pop-ups & middle-click links (`LifeSpanHandler`, `on_open_urlfrom_tab`):** Cancel
  all unmanaged CEF native popup windows (`on_before_popup` always returns `1`); refuse
  `file://`, credentialed, and non-HTTP(S) pop-ups; route user-activated `http(s)` /
  `about:blank` pop-ups and middle-clicked links to managed tabs in the opener's
  session (`EngineMsg::PopupOpen`, inheriting `agent_driven`); hold non-user-gesture
  pop-ups in a 500 ms guarded "Pop-up blocked" bar (`EngineMsg::PopupBlocked`).
- **Permissions (`PermissionHandler`):** Deny unknown permissions, desktop capture,
  cross-origin frames, insecure origins, and older-app connections immediately (closing
  `review-browser-policy.md` §7); queue and coalesce allowed
  `{camera, microphone, location, notifications, clipboard-read}` requests so every
  CEF callback settles once; render in-pane permission bar (`Never allow` / `Allow this
  time` / `Always allow` persisted in `plugin.browser/rune.sitePermissions`; agent tabs
  never inherit kept allows and auto-deny after 20 s; origin changes clear visit state
  and settle pending callbacks).
- **JS dialogs (`JsdialogHandler`):** Hold `alert`/`confirm`/`prompt`/`beforeunload`
  when `Hello.prompts == true` (skipping `beforeunload` on agent-driven tabs; cleanly
  suppressing dialogs when connected to older apps so CEF never spawns OS dialogs);
  render pane-scoped `alertdialog` modal with 500 ms activation delay, 1 s repeat-dialog
  suppression checkbox, scrollable 160 px page text, bidi/control sanitization,
  card-level focus trap + `MODAL`-band key isolation (`F6`/`Mod+L` escape hatch,
  window chords passed through, key repeats ignored), immediate `[browser.dialog_open]`
  / `[browser.dialog_interrupted]` handling (leaving `Page.handleJavaScriptDialog` open).
- **HTTP auth & client certificates (`RequestHandler`):** Cancel all client certificate
  requests (`on_select_client_certificate` -> `select(None)`); restrict HTTP 401 auth
  (`Basic`/`Digest`/`NTLM`/`Negotiate`) to same-origin top-level `http(s)` challenges
  (clearing `pending_top_url` on load end/error/stop and updating on main-frame
  redirects; 3 attempts max, queued/coalesced, retry error alert, immediate credential
  clearing); cancel immediately on agent-driven tabs with `AuthAgentRequired`.
- **Agent file choosers (`DialogHandler`):** Cancel OS file choosers on agent-driven
  tabs (`FileChooserBlocked`) and mark tabs opened/driven by MCP tools as `agent_driven`.
@Hona
Hona merged commit 5280161 into dev Nov 20, 2026
6 checks passed
@Hona
Hona deleted the ws1-phase1b branch November 20, 2026 09:59
@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 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