fix: electron renderer with nodeintegration enabled and sandbox disabled#478
Open
kumburovicbranko682-boop wants to merge 1 commit into
Conversation
…dbox disabled The launcher window runs with `nodeIntegration: true` and `sandbox: false` as documented in the inline comment. This means any JavaScript executing in that renderer (including third-party Raycast extensions) has unrestricted access to Node.js APIs — fs, child_process, crypto, etc. If an extension contains an XSS vulnerability, or if an attacker compromises a Raycast store extension, they gain full filesystem and process access on the host machine. Electron's official security documentation explicitly warns against this configuration. The recommended approach is to use `contextBridge` + `preload` scripts to expose only the specific APIs extensions need, rather than granting blanket Node access. The SECURITY.md mentions an "Electron Security Architecture" section but does not disclose this risk. Affected files: vite.config.ts Signed-off-by: kumburovicbranko682-boop <295886834+kumburovicbranko682-boop@users.noreply.github.com>
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.
🔒 Security Fix
Problem
The launcher window runs with
nodeIntegration: trueandsandbox: falseas documented in the inline comment.This means any JavaScript executing in that renderer (including third-party Raycast extensions) has unrestricted
access to Node.js APIs — fs, child_process, crypto, etc. If an extension contains an XSS vulnerability, or if
an attacker compromises a Raycast store extension, they gain full filesystem and process access on the host machine.
Electron's official security documentation explicitly warns against this configuration. The recommended approach
is to use
contextBridge+preloadscripts to expose only the specific APIs extensions need, rather thangranting blanket Node access.
The SECURITY.md mentions an "Electron Security Architecture" section but does not disclose this risk.
Severity:
highFile:
vite.config.tsSolution
Refactor to use Electron's recommended security model:
nodeIntegration: falseandsandbox: truein the BrowserWindow webPreferences.contextBridge.exposeInMainWorld()to expose only the specificNode APIs required by Raycast extensions (e.g., a controlled
requireshim or a curated API surface).ipcRenderer/ipcMainfor privileged operations, with an allowlist of valid IPC channels.Example BrowserWindow config:
Changes
vite.config.ts(modified)Testing
🤖 About this PR
This pull request was generated by ContribAI, an AI agent
that helps improve open source projects. The change was:
If you have questions or feedback about this PR, please comment below.
We appreciate your time reviewing this contribution!
Closes #477