Repository navigation
fix(browser): allow trusted embedded popup windows - #7392
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughBrowserManager now allows permitted guest popups as Electron child windows with constrained options, propagates guest policies and ownership context through 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: Orca <[email protected]>
Jinwoo-H
left a comment
There was a problem hiding this comment.
Thanks—this is the right root-cause fix for popup-based OAuth flows. Before landing, I tightened the native-window boundary and added regression coverage:
- Block local-file popup targets and disruptive native-window options.
- Preserve opener/postMessage/window.close across nested popup flows.
- Route child permissions/downloads to the owner while isolating child load failures.
- Clean up descendant ownership without adding hot-path scans.
Verified in Electron with a live opener round trip, repeat popup creation, normal native chrome, window.close, and file-popup denial. All 123 affected tests pass.
…me-less child windows (#8343) * fix: host browser popups in an Orca origin-bar window instead of chrome-less child windows A guest-opened popup previously became a default Electron child window with no address bar, so users could not verify a popup's origin — a phishing surface flagged in the prod-release scan of #7392. The reverted #8332 tried gating on disposition, which is bypassable and breaks featureless window.open() OAuth flows. Instead, keep hosting popups in-app (preserving the shared session partition and live window.opener handle OAuth depends on) but build the child window ourselves via setWindowOpenHandler's createWindow callback: a BaseWindow with an Orca-controlled origin-bar WebContentsView on top and a content WebContentsView that adopts the pre-created popup WebContents. The bar shows only the destination origin (never path or query), updates on navigation, and flags plain http to remote hosts. Also pins secure webPreferences (contextIsolation, no nodeIntegration, sandbox, no webviewTag) on popup children via SAFE_POPUP_WINDOW_OPTIONS, attaches guest policies to popup contents directly (did-create-window does not fire for createWindow children), emits the existing opened-in-orca renderer notice, and closes popups with their opener guest. Co-authored-by: Orca <[email protected]> * fix: show page title in popup title bar instead of doubling the origin The native title bar and the origin bar both showed the origin, reading as a doubled header. Match Chrome popup behavior: title bar shows the page title (reset to origin on navigation so a stale title cannot outlive its origin); the origin bar below remains the unspoofable trust surface. Co-authored-by: Orca <[email protected]> * fix: elide the start of long popup origins so the registrable domain stays visible Adversarial review findings on the origin bar: - The bar right-ellipsized long hostnames, hiding exactly the part that matters: window.open('https://accounts.google.com.<...>.evil.com', '', 'width=360') rendered as 'https://accounts.google.com.signin.s…'. Clip from the left instead (rtl container + isolated ltr bdi so host and port keep normal character order), matching how Chrome elides. - Re-assert the origin on the popup's did-finish-load so a transiently dropped executeJavaScript write cannot leave a stale origin up. - Re-pin view layout on enter/leave-full-screen: verified at runtime that HTML5 fullscreen keeps the bar visible on macOS (resize fires); the explicit events make that hold on every platform. - Test hardening: fake WebContents now flips isDestroyed after 'destroyed' so the double-close guard is actually exercised. Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Orca <[email protected]>
* fix(browser): allow trusted embedded popup windows * fix(browser): harden embedded popup windows Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Jinwoo-H <[email protected]> Co-authored-by: Orca <[email protected]>
…me-less child windows (stablyai#8343) * fix: host browser popups in an Orca origin-bar window instead of chrome-less child windows A guest-opened popup previously became a default Electron child window with no address bar, so users could not verify a popup's origin — a phishing surface flagged in the prod-release scan of stablyai#7392. The reverted stablyai#8332 tried gating on disposition, which is bypassable and breaks featureless window.open() OAuth flows. Instead, keep hosting popups in-app (preserving the shared session partition and live window.opener handle OAuth depends on) but build the child window ourselves via setWindowOpenHandler's createWindow callback: a BaseWindow with an Orca-controlled origin-bar WebContentsView on top and a content WebContentsView that adopts the pre-created popup WebContents. The bar shows only the destination origin (never path or query), updates on navigation, and flags plain http to remote hosts. Also pins secure webPreferences (contextIsolation, no nodeIntegration, sandbox, no webviewTag) on popup children via SAFE_POPUP_WINDOW_OPTIONS, attaches guest policies to popup contents directly (did-create-window does not fire for createWindow children), emits the existing opened-in-orca renderer notice, and closes popups with their opener guest. Co-authored-by: Orca <[email protected]> * fix: show page title in popup title bar instead of doubling the origin The native title bar and the origin bar both showed the origin, reading as a doubled header. Match Chrome popup behavior: title bar shows the page title (reset to origin on navigation so a stale title cannot outlive its origin); the origin bar below remains the unspoofable trust surface. Co-authored-by: Orca <[email protected]> * fix: elide the start of long popup origins so the registrable domain stays visible Adversarial review findings on the origin bar: - The bar right-ellipsized long hostnames, hiding exactly the part that matters: window.open('https://accounts.google.com.<...>.evil.com', '', 'width=360') rendered as 'https://accounts.google.com.signin.s…'. Clip from the left instead (rtl container + isolated ltr bdi so host and port keep normal character order), matching how Chrome elides. - Re-assert the origin on the popup's did-finish-load so a transiently dropped executeJavaScript write cannot leave a stale origin up. - Re-pin view layout on enter/leave-full-screen: verified at runtime that HTML5 fullscreen keeps the bar visible on macOS (resize fires); the explicit events make that hold on every platform. - Test hardening: fake WebContents now flips isDestroyed after 'destroyed' so the double-close guard is actually exercised. Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Orca <[email protected]>
Summary
WebContentsthat Electron creates.Closes #7374.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation:
pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-manager.test.ts -t "allows registered safe popup URLs as Electron child windows"- passed.pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-manager.test.ts -t "falls back to opening popup URLs externally before a guest is registered"- passed.pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-manager.test.ts -t "blocks unsafe popup URLs for registered guests"- passed.pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-manager.test.ts -t "attaches guest policies to created popup child windows"- passed.pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-manager.test.ts- passed.pnpm run typecheck:node- passed.AI Review Report
No issues found in the final diff review.
Security Audit
No new security issues found.
normalizeBrowserNavigationUrl.javascript:alert(1), still deny with sanitized origin metadata.WebContentsinherits BrowserManager navigation guards and anti-detection setup throughattachGuestPolicies.Notes
No visual change. Out of scope: claiming that every OAuth provider accepts Electron embedded browsers. Some providers can still reject embedded user agents independently of popup support.