fix(electron): block untrusted main-window navigation - #71
Merged
Conversation
Prevent the privileged BrowserWindow from committing remote navigations or redirects while preserving application and recovery targets. Model: gpt-5
wibus-wee
reviewed
Aug 27, 2026
wibus-wee
left a comment
Member
There was a problem hiding this comment.
LGTM! Thanks for your contribution!
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.
Author type
Problem / pressure
The privileged Electron main window could navigate to a remote document while retaining its preload bridge, allowing remote content to reach high-privilege IPC and ultimately execute local commands.
Summary
Restrict top-level main-window navigations and redirects to the existing application and recovery renderer targets. Blocked HTTP(S) destinations are opened in the system browser.
Before / after
Test plan
git diff --checksuccessfully.Agent handoff
Instructions for reviewing agents
apps/electron/src/main/window.ts, especially URL normalization and both navigation event handlers.Authoring context
.mjstest and no manual packaged-app smoke test, per the requested narrow scope.Sharing consent (author side)
N/A/ redacted