← ClaudeAtlas

electron-securitylisted

Harden Electron apps: renderer trust boundary (nodeIntegration, contextIsolation, sandbox), contextBridge/IPC allowlists, shell.openExternal, navigation guards, deep-link auth, safeStorage — Applies to: when generating Electron main-process code (BrowserWindow, ipcMain, app events); when generating a preload script or contextBridge surface; when wiring custom-protocol / deep-link handlers; when storing tokens or secrets in an Electron app; when reviewing Electron IPC, navigation, or window configuration
ShieldNet-360/secure-vibe · ★ 3 · AI & Automation · score 76
Install: claude install-skill ShieldNet-360/secure-vibe
<!-- Native skill bundle for Claude Code. Generated by `secure-vibe dev regenerate`. --> <!-- Do not edit by hand; the source of truth is skills/electron-security/SKILL.md. --> # Electron Desktop Security Harden Electron apps: renderer trust boundary (nodeIntegration, contextIsolation, sandbox), contextBridge/IPC allowlists, shell.openExternal, navigation guards, deep-link auth, safeStorage ## ALWAYS - Configure every `BrowserWindow` with `nodeIntegration: false`, `contextIsolation: true`, and `sandbox: true`. The preload + contextBridge is the supported way to give the renderer capabilities — the page never needs Node. - Expose a **minimal, typed** API from the preload via `contextBridge.exposeInMainWorld`. Expose named functions only — never hand the renderer `ipcRenderer`, `require`, `process`, or whole modules. - Validate **every** IPC argument in the main-process handler: type-check, bound, and allowlist. The renderer is an attacker-controlled input source. - Spawn child processes with `execFile` / `spawn` and an **argument array** — never `exec` with a shell string built from renderer input. Allowlist each argument (e.g. `^[A-Za-z0-9_-]+$`). - Confine filesystem paths: `path.resolve(base, input)` then verify the result `startsWith(base + path.sep)`. Reject absolute paths and `..` segments. - Allowlist `shell.openExternal` to `https:` (and `mailto:` if needed) after parsing the URL. Reject `file:`, custom schemes, and anything else. - Add navigation guards: `app.on('