Hub rules-electron

rules-electron

v5 public Verified

Electron

Electron is a framework for building cross-platform desktop applications using web technologies. These rules assist AI agents in multi-process architecture, secure IPC communication, and native API integration.

@sigmashakeinc 3 pulls 14 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-electron →
Severity
8 error 6 warn 0 info
demo.cast
Electron is a framework for building cross-platform desktop applications using web technologies. These rules assist AI agents in multi-process architecture, secure IPC communication, and native API integration.

Rules index

14 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

electron

electron-deny-context-bridge-overexposure error block

RISK: contextBridge.exposeInMainWorld that hands the page the raw ipcRenderer, require, or a passthrough send(channel,...) lets the renderer invoke ANY IPC channel or Node module — it defeats the whole point of the bridge (CWE-749, Electron checklist #3). FIX: expose a small fixed object of named methods, each hard-coding its channel (e.g. getRules: () => ipcRenderer.invoke('rules:list')); never forward an attacker-chosen channel name or expose require/process.

Rule source requires an active Pro or Enterprise subscription.
electron-deny-context-isolation-off error block

RISK: contextIsolation:false runs the preload and the loaded page in the same JS context, so a malicious page can reach into your privileged preload objects and Electron internals (CWE-1188, Electron checklist #3). FIX: keep contextIsolation:true (default since Electron 12) and pass APIs across the boundary only via contextBridge.exposeInMainWorld.

Rule source requires an active Pro or Enterprise subscription.
electron-deny-execute-javascript-interpolation error block

RISK: webContents.executeJavaScript with a template literal or string-concatenated value injects untrusted data straight into the page's JS engine — classic script injection / XSS-to-RCE (CWE-95 eval injection). FIX: never build the script from runtime data; pass data into the page via a preload contextBridge method or postMessage and run a static, pre-written script.

Rule source requires an active Pro or Enterprise subscription.
electron-deny-insecure-content error block

RISK: allowRunningInsecureContent:true lets an https page pull scripts over plain http, giving a network MITM script-injection into your renderer (CWE-311, Electron checklist #7). FIX: remove the flag (defaults to false) and load every sub-resource over https or a bundled local protocol.

Rule source requires an active Pro or Enterprise subscription.
electron-deny-node-integration error block

RISK: webPreferences nodeIntegration:true exposes Node's require/child_process/fs to the renderer; any XSS or compromised remote page becomes full host RCE (CWE-94, Electron security checklist #2). FIX: keep nodeIntegration:false (the default) and surface only the specific calls the UI needs through a contextBridge allow-list in a preload script.

Rule source requires an active Pro or Enterprise subscription.
electron-deny-remote-module error block

RISK: the remote module (enableRemoteModule:true / @electron/remote) hands the renderer live references to main-process objects like app, BrowserWindow, and child_process — a compromised page calls them directly for RCE (CVE-2018-1000136 class, removed from core in Electron 14). FIX: delete the remote module; expose only the exact operations the UI needs via a typed IPC/RPC channel (e.g. BrowserView.defineRPC) validated in the main process.

Rule source requires an active Pro or Enterprise subscription.
electron-deny-shell-open-external-injection error block

RISK: shell.openExternal/openPath (and Electrobun Utils.openExternal/openPath) hand the string to the OS shell handler — an unvalidated value enables command/URL injection and dangerous schemes like file:, smb:, javascript:, or a crafted ms-msdt: payload (CWE-78, CVE-2018-1000006 / Follina-class). FIX: pass only string literals you control; for dynamic values parse with new URL() and allow only http:/https:/mailto: (and a vetted path root for openPath) before calling.

Rule source requires an active Pro or Enterprise subscription.
electron-deny-web-security-off error block

RISK: webSecurity:false turns off the same-origin policy and lets any page read cross-origin responses and load file:// resources, defeating CSP and enabling credential theft (CWE-942, Electron checklist #5). FIX: never disable webSecurity; serve local assets from a custom protocol and request remote APIs through fetch with explicit CORS.

Rule source requires an active Pro or Enterprise subscription.
electron-force-updated-api warning log

RISK: remote.require() pulls a main-process module into the renderer through the deprecated remote bridge — it both leaks privileged APIs to the page and was removed from Electron core in v14 (Electron checklist #15). FIX: replace it with a dedicated ipcRenderer.invoke / contextBridge call whose main-side handler does the work and returns only serializable data.

Rule source requires an active Pro or Enterprise subscription.
electron-warn-csp-unsafe warning log

RISK: a CSP that allows 'unsafe-eval', 'unsafe-inline' for script-src, or a wildcard script-src lets injected markup execute, removing the last line of defence against renderer XSS in a privileged Electron window (CWE-1021, Electron checklist #6). FIX: ship a strict CSP — default-src 'none'; script-src 'self'; no 'unsafe-eval'/'unsafe-inline'; use nonces/hashes for any inline script and bundle eval-free code.

Rule source requires an active Pro or Enterprise subscription.
electron-warn-ipc-untrusted-fs-exec warning log

RISK: an ipcMain.handle/on handler that feeds a renderer-supplied argument into fs.* or child_process treats the (untrusted) renderer as authoritative — a compromised page reads/overwrites arbitrary files or runs commands (CWE-20/CWE-78, Electron checklist #2 IPC validation). FIX: validate and canonicalise every argument in the handler — assert the sender frame, allow-list the operation, resolve paths under a fixed base dir and reject '..'/absolute escapes, and never pass renderer input to a shell.

Rule source requires an active Pro or Enterprise subscription.
electron-warn-load-remote-origin warning log

RISK: loadURL/loadFile pointed at a remote http(s) origin runs third-party, network-controlled HTML inside your app's privileged window; a server compromise or MITM becomes code in your renderer (Electron checklist #1 — only load content you control). NOTE: SigmaShake Desktop loads only http://127.0.0.1:<port> (the local ssg dashboard), which is fine. FIX: bundle the UI and load it from a local file/custom protocol, or pin a single first-party https origin behind webSecurity + a strict CSP and a will-navigate allow-list.

Rule source requires an active Pro or Enterprise subscription.
electron-warn-missing-navigation-guard warning log

RISK: a BrowserWindow with no will-navigate or setWindowOpenHandler guard lets in-page links/redirects navigate the privileged window to an attacker origin or spawn arbitrary child windows (Electron checklist #12/#13, CWE-601 open redirect). FIX: add webContents.on('will-navigate', (e,url) => { if (!isAllowed(url)) e.preventDefault(); }) and setWindowOpenHandler(({url}) => isAllowed(url) ? {action:'allow'} : {action:'deny'}) with a first-party allow-list.

Rule source requires an active Pro or Enterprise subscription.
electron-warn-sandbox-disabled warning log

RISK: sandbox:false drops the OS-level renderer sandbox, so a renderer-side memory bug or supply-chain script reaches the host directly (Electron checklist #4; cf. SigmaShake Desktop ships its dashboard window with sandbox:true). FIX: set sandbox:true on every BrowserWindow/webPreferences and move any Node work into the main process behind an IPC handler.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v5
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
fde77d4008b82fd28bbb33a399e1a918e33f47d7f132c98e64acc9750f29ef27
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-electron/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-electron. The published version only bumps when a maintainer resyncs.

No commit history available.