electron-security

electron-security is a skill for Claude Code, Codex from ShieldNet-360/secure-vibe. It costs 73 tokens per session (2,515 once invoked), scanned A, original, MIT.

A security guide for Electron desktop apps, which use web pages inside a desktop program. It explains how to keep untrusted page code away from Node.js, the shell, files, and session tokens.

In plain words
What is it for?
Use it when configuring Electron windows, preload scripts, inter-process messages, external links, navigation, deep-link login, and release-build settings.
Why use it?
It reduces the damage an attacker could cause through a cross-site scripting bug, redirect, deep link, or unsafe message between processes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/shieldnet-360/secure-vibe/electron-security
Any agent
npx skills add ShieldNet-360/secure-vibe --skill electron-security
Clone the repo
git clone --depth 1 https://github.com/ShieldNet-360/secure-vibe

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for electron-security

README.md
[![agentmods](https://agentmods.dev/badge/skills/shieldnet-360/secure-vibe/electron-security.svg)](https://agentmods.dev/skills/shieldnet-360/secure-vibe/electron-security)
Your own site
<a href="https://agentmods.dev/skills/shieldnet-360/secure-vibe/electron-security"><img src="https://agentmods.dev/badge/skills/shieldnet-360/secure-vibe/electron-security.svg" alt="Measured on agentmods" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,515 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00073 $0.02515
Opus 5 $0.00036 $0.01257
Sonnet 5 $0.00015 $0.00503
Haiku 4.5 $0.00007 $0.00251

Measured 4d ago against content hash f11a89b3bced, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

electron-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/electron-security/SKILL.md · 173 lines

How it starts

The opening of the file, as written. The whole thing — 173 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Electron Desktop Security

Rules (for AI agents)

ALWAYS

  • Treat the renderer as untrusted. Any renderer-side code execution — XSS in rendered content, a redirect, a deep link — must not be able to reach Node, the shell, the filesystem, or session tokens. Every other rule here follows from this one, and every IPC sink you expose is reachable from a compromised renderer.
  • Keep the renderer's process isolation at its defaults rather than restoring them: nodeIntegration: false, contextIsolation: true and sandbox: true have been Electron's defaults for several major versions, so the finding is the line that turns one off. Note the coupling: under sandbox: true a preload gets a polyfilled module subset, so a preload needing fs fails — move that work behind IPC into the main process, never drop the sandbox.
  • Set the packaging fuses on release builds: disable RunAsNode, EnableNodeCliInspectArguments and EnableNodeOptionsEnvironmentVariable. With RunAsNode on, an attacker runs your signed binary as a plain Node process and every renderer-side control above becomes irrelevant — a build-time setting no runtime hardening substitutes for.
  • 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. Do not add @electron/remote: it restores the main-process object access that was removed from core precisely because it defeats the boundary.
  • 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 — that is command injection. 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. Concatenating a renderer-supplied path (${BASE}${filePath}) is path traversal and arbitrary file write.
  • Allowlist shell.openExternal to https: (and mailto: if needed) after parsing the URL. Reject file:, custom schemes, and anything else — an arbitrary or renderer-controlled URL here is a local-launch and RCE vector.
  • Add navigation guards: app.on('web-contents-created', …) with contents.on('will-navigate', …) and contents.setWindowOpenHandler(…) that deny by default against a strict origin allowlist. Keep webviewTag: false; where a <webview> is genuinely required, strip its preload and reset its options in will-attach-webview.
  • Remember the contextBridge surface is exposed to whatever origin the webContents currently holds — the preload re-runs on navigation and exposeInMainWorld does not re-check origin. One missing will-navigate guard lets an attacker origin inherit your entire IPC surface: that is how a stored hyperlink becomes 1-click RCE. Gating the preload on location is defense in depth, not the control.
  • Before attaching session tokens or cookies to an outbound request, verify the target host is on your own-API allowlist. Never attach credentials to a renderer-supplied URL — an XSS then exfiltrates the token.
  • Bind custom-protocol / deep-link auth to a one-time state / PKCE value the app generated and is waiting for; validate before storing any token. Accepting myapp://auth?refresh-token=… unvalidated is login CSRF and session fixation.
  • Store tokens with Electron safeStorage, not app-level crypto — and check safeStorage.isEncryptionAvailable() first: on Linux with no keyring the backend falls back to a fixed key, so the ciphertext is not confidential. Ship release builds code-signed, with ASAR integrity where the platform supports it (macOS and Windows).
  • Treat every server the app connects to — your own API, an auto-update channel, a telemetry endpoint, a shared multi-tenant backend — as potentially attacker-controlled. Never load a server-supplied URL into a window carrying your preload, and never feed a server response into an IPC sink (file path, shell argument, openExternal URL) without the validation you apply to renderer input.
  • Harden parsers consuming untrusted server or stream data: bound every length field before allocating, cap recursion and include-style expansion (circular references become an infinite loop), and wrap the parse in try/catch. A malicious server otherwise hangs the renderer even where memory safety rules out RCE.
  • Consult frontend-security for the renderer's own browser surface — Content Security Policy, DOM sinks, sanitizer choice. The renderer is a browser; that skill owns what runs inside it, this one owns what it can reach beyond it.

Read the full file on GitHub · 173 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 173 lines · 73 tokens per session scan A f11a89b3bced

Subscribe to this mod's changes

electron-security is a skill published in the GitHub repository ShieldNet-360/secure-vibe (22 stars, last pushed 21d ago), licensed MIT. It adds 73 tokens to every session and 2,515 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

deno-sandbox

Use when building features that execute untrusted user code, AI-generated code, or need isolated code execution environments. Covers the @deno/sandbox SDK.

denoland/skills · 36 tokens

deno-frontend

Use when building a web frontend with Deno — running React, Vite, Astro, SvelteKit, Next.js, Nuxt or other npm frameworks under Deno, or working with Fresh, Deno's own island-architecture framework. Covers which path to pick, Fresh 2.x routes, handlers, islands, Preact signals, Tailwind, and Fresh 1.x to 2.x migration.

denoland/skills · 88 tokens

web-performance-reviewer

Review web frontends for performance issues by driving the rendered site through Chrome DevTools MCP — throttled performance traces, Core Web Vitals judged against thresholds, network waterfall analysis, and heap-snapshot leak checks for SPAs. Composes on top of web-static, web-sprinkles, or web-components. Strictly…

AdamBien/airails · 193 tokens

web-static

Build modern static websites using semantic HTML and CSS without external dependencies or build systems. Also owns the verification loop for such sites — drives the rendered pages through Chrome DevTools MCP (console, accessibility snapshot, viewport resize, dark/reduced-motion emulation, Lighthouse), executes the…

AdamBien/airails · 183 tokens

zcfg

Integrate zcfg (Zero Dependency Configuration Utility) into Java applications. Use when adding configuration loading, reading properties files, setting up application configuration, or integrating zcfg into a Java project. Triggers on "zcfg", "add configuration", "load properties", "application configuration with…

AdamBien/airails · 75 tokens

zcl

Add colored terminal output to Java applications using zcl (Zero-dependency Colour Logger). Use when adding colored console output, terminal logging with colors, ANSI color support, or integrating zcl into a Java project. Triggers on "zcl", "colored output", "colored logging", "terminal colors", "ANSI colors"…

AdamBien/airails · 85 tokens