fix(desktop): oauth popups open from the browser preview - #8435
Draft
walid-baharwal wants to merge 2 commits into
Draft
fix(desktop): oauth popups open from the browser preview#8435walid-baharwal wants to merge 2 commits into
walid-baharwal wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Scripted `window.open` calls inside the integrated browser preview were denied and loaded in the preview tab instead. Firebase `signInWithPopup` got a null window handle back and reported `auth/popup-blocked`, and the in-tab load also dropped the opener the popup needs to post the credential back to. Popups with a `new-window` disposition and an http or https URL now get a real window, with context isolation and the sandbox turned back on: a popup is not a webview attach, so the `will-attach-webview` hardening never sees it and an unoverridden child would inherit the picker preload's relaxed posture. `about:blank` popups keep loading in the preview tab, since Chromium copies the guest preferences for them and forbids overriding. Links with `target="_blank"` are unchanged. Fixes pingdotgg#6561
walid-baharwal
force-pushed
the
fix/preview-oauth-popups
branch
from
August 27, 2026 18:16
e598878 to
8fa05ae
Compare
An allowed popup carried Electron's default window-open behavior, so a page inside it could spawn native windows without limit. The popup now denies its own window.open calls; no OAuth flow opens a second popup. The popup preferences also drop nodeIntegrationInSubFrames, matching the three keys every other hardened window in the app sets.
walid-baharwal
force-pushed
the
fix/preview-oauth-popups
branch
from
August 27, 2026 18:31
d2ce056 to
7c5b69a
Compare
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.
What Changed
window.openfrom a page in the integrated browser preview now opens a real window when the disposition isnew-windowand the URL is http or https. Everything else, includingtarget="_blank"links, keeps loading in the preview tab as it does today.The popup is created with
contextIsolation,sandbox, andnodeIntegration: falseset explicitly. A popup is not a webview attach, so thewill-attach-webviewhardening inDesktopWindownever sees it, and an unoverridden child would inherit the picker preload's relaxed posture.about:blankpopups stay in the preview tab: Chromium skips browser-side navigation for them, copies the guest preferences, and gives no way to override.One file plus its test:
apps/desktop/src/preview/Manager.ts(+56/−2).Why
A local app opened in the preview cannot finish an OAuth popup flow. Firebase
signInWithPopup(auth, new GoogleAuthProvider())reportsauth/popup-blockedand no window appears, while the same app works in a normal Chrome or Firefox window.The handler denied every
window.openand loaded the URL in the same webContents.window.open()therefore returnednull, which the Firebase SDK reads as a blocked popup, and the in-tab load also destroyed the opener that the popup has topostMessageits credential back to. The handler already receiveddispositionand ignored it, so scripted popups andtarget="_blank"links took the same wrong branch.The renderer side already sets
allowpopupson the<webview>(apps/web/src/browser/HostedBrowserWebview.tsx), so no client change was needed.Surfaces
Desktop only. The preview
<webview>exists inside Electron, and remote web previews never reachsetWindowOpenHandler. No contract, provider, or docs change.UI Changes
No rendered UI, layout, or motion changed. The behavior is interaction-dependent, so a screen recording of the sign-in flow is coming before this leaves draft.
Verification
isPreviewRefreshShortcut, the existing pure helper in the same file.vp test run apps/desktop/src/preview/Manager.test.tshas not run on my machine: the install did not finish over my connection. CI is the first full run of these tests, and I will fix whatever it reports.signInWithPopupapp in a preview tab, plus atarget="_blank"link to confirm it still loads in-tab, lands with the recording.Checklist
Fixes #6561
Written with Claude Opus 5 in Claude Code.