- Home
- Skills
- Code Quality & Review
- electron surface audit
Works with the AI Agents you already use
electron surface audit
Audit any Electron app straight from disk: fuse state out of the binary, ASAR integrity, and 20 code rules for the flags that turn a renderer bug into code execution. Two seconds, no window, no network.
Free
electron surface audit
Example session with this skill installed
python scripts/audit.py "C:\Program Files\SomeApp\SomeApp.exe" --fail-on high
- Read your context and instructions
- Compiled the electron surface audit
target C:\Program Files\SomeApp\SomeApp.exe
exe C:\Program Files\SomeApp\SomeApp.exe
asar C:\Program Files\SomeApp\resources\app.asar
score 21/100 grade F (critical)
fuse penalty 117, code penalty 23
FUSES
[RISK] Run as Node enabled safe=disabled
[RISK] Cookie encryption disabled safe=enabled
[RISK] NODE_OPTIONS support enabled safe=disabled
[RISK] --inspect arguments enabled safe=disabled
[RISK] Embedded ASAR integrity disabled safe=enabled
[RISK] Only load app from ASAR disabled safe=enabled
[RISK] Browser-specific V8 snapshot disabled safe=enabled
[RISK] file:// extra privileges enabled safe=disabled
[ ok ] WASM trap handlers enabled safe=enabled
FINDINGS
[high ] ES-011 shell.openExternal called with a non-literal argument
at lib/main.js:10044
} else await shell.openExternal(url);
fix: Parse with new URL(), allow only http(s), compare the host
against an allowlist, and reject everything else.
[high ] ES-018 Auto-updater trusts an unsigned feed
at updater.js:88
updater.setFeedURL = function(url){
fix: Use a provider with signed manifests, pin the signing key, and
verify the downloaded artifact before it is applied.
COVERAGE LIMITS
- Scanned 120 of 467 candidate script files (caps: 120 files / 32 MB).
Raise --max-files or pass --include-deps to cover more.
exit code 1
Connects securely to your tools. The creator never sees your data.
About this skill
Your Electron app is one boolean away from remote code execution
Not a metaphor. This is the whole attack:
webPreferences: { nodeIntegration: true } // someone added this in 2019
A page renders. Something gets a script into it — a third-party widget, an
XSS in a bundled UI library, an injected proxy response. That script now calls
require('child_process').exec() with your user's permissions.
No memory corruption. No sandbox escape. No exploit chain. One configuration line, plus anything that achieves script execution.
And you cannot see it from outside. The installer is signed. The icon is polished. The app runs normally. The only way to know is to read the binary and the archive.
What this does
electron-surface-audit reads three things off disk and reports what an attacker
would use first.
1. Fuses — the switchboard compiled into the executable.
Electron embeds nine compile-time switches in the binary, at a sentinel-delimited
table. They are not in your source code, not in package.json, and there is no API
to read them. This tool locates the table, decodes the positional state array, and
compares each fuse against its safe value.
RunAsNode: enabled means ELECTRON_RUN_AS_NODE=1 your-app.exe turns your signed
application into a Node interpreter, carrying your bundle identity — and on macOS,
your TCC permissions. OnlyLoadAppFromAsar: disabled means a loose app/ directory
dropped next to the archive wins at launch.
2. ASAR integrity.
Which archive the executable will actually load, and whether it is the one you
signed. If a live app.asar is gone and only app.asar.bak remains, the report says
which file it audited instead of pretending.
3. Application code — 20 rules over your own JavaScript and HTML.
| id | severity | catches |
|---|---|---|
| ES-001 | critical | nodeIntegration: true |
| ES-002 | critical | contextIsolation: false |
| ES-003 | high | sandbox: false |
| ES-004 | critical | webSecurity: false |
| ES-005 | high | allowRunningInsecureContent: true |
| ES-006 | medium | experimentalFeatures: true |
| ES-007 | medium | enableBlinkFeatures |
| ES-008 | high | remote content over plain HTTP |
| ES-009 | high | remote content in a privileged window |
| ES-010 | medium | no Content-Security-Policy |
| ES-011 | high | shell.openExternal with an unguarded argument |
| ES-012 | high | ipcMain handler with no sender validation |
| ES-013 | medium | <webview> enabled |
| ES-014 | medium | window-open handler returns allow |
| ES-015 | medium | no will-navigate guard |
| ES-016 | high | preload exposes a raw module |
| ES-017 | medium | no permission request handler |
| ES-018 | high | updater trusts an unsigned feed |
| ES-019 | medium | remote module |
| ES-020 | low | DevTools opened unconditionally |
Comments are stripped before matching, so documentation and commented-out examples
stay quiet. node_modules is excluded by default — the audit is about the code you
maintain, and telling you to patch a dependency's defaults is not actionable.
Example session
$ python scripts/audit.py "C:\Program Files\SomeApp\SomeApp.exe"
target C:\Program Files\SomeApp\SomeApp.exe
asar C:\Program Files\SomeApp\resources\app.asar
score 21/100 grade F (critical)
fuse penalty 117, code penalty 23
FUSES
[RISK] Run as Node enabled safe=disabled
[RISK] Cookie encryption disabled safe=enabled
[RISK] NODE_OPTIONS support enabled safe=disabled
[RISK] --inspect arguments enabled safe=disabled
[RISK] Embedded ASAR integrity disabled safe=enabled
[RISK] Only load app from ASAR disabled safe=enabled
[RISK] file:// extra privileges enabled safe=disabled
[ ok ] WASM trap handlers enabled safe=enabled
FINDINGS
[high ] ES-011 shell.openExternal called with a non-literal argument
at lib/main.js:10044
} else await shell.openExternal(url);
fix: Parse with new URL(), allow only http(s), compare the host
against an allowlist, and reject everything else.
Two real reports ship in references/examples/ — a 2019-era note app at 27/100 with
three live nodeIntegration: true sites, and a current AI desktop client at 21/100
with eight fuse risks. Neither vendor advertises these.
Three decisions that make the number usable
not assessed is not 100.
When neither a fuse table nor an application archive can be read, the tool prints
not assessed. A launcher stub and a hardened app must not look the same. Most
scanners get this wrong and call an unreadable target clean.
Exponential scoring, critical cap.
Linear subtraction puts a three-finding legacy app and a twenty-finding modern app
both at zero, and the number stops discriminating. Here score = 100 · e^(−penalty/90),
capped at 65 whenever a critical exists.
Guards suppress noise, and the suppression is recorded.
ES-011 checks the statement and the four lines above it for new URL(), a
protocol === 'https:' comparison, or an allowlist. If the guard is present, the
finding is suppressed — and listed in the JSON as suppressed, with the reason. You can
audit the auditor.
Why this beats prompting it yourself
You can ask a model "is this Electron app secure?" It will answer confidently. It cannot:
- Read the fuse state of a compiled binary. No API. The bytes are at a sentinel
table inside the
.exe. Reading them means locating the sentinel, decoding a positional array, and knowing what each of nine values means for exploitability. A model reading your source never sees this layer at all. - Know which archive will load.
resources/app.asar,resources/app/*.asar, a.bakthat outlived the live file — the resolution order matters, and a wrong guess audits the wrong program. - Tell "not found" from "not there". "No
setPermissionRequestHandleranywhere" means one thing across 14 files and another across 120 of 9,904. The tool tracks scan completeness and marks each absence findingpartial_evidence: truewhen it truncated. - Produce something reproducible. A report with file:line citations can go into a
code review, be diffed between releases, and gate CI with
--fail-on high. A chat transcript cannot.
Use cases
- Pre-release review. Run it in CI on the packaged artifact, not the source tree.
--fail-on highfails the build. - Dependency triage. You downloaded a desktop tool and want to know what it can do to your machine before running it.
- Vendor conversations. "Your build has
RunAsNodeenabled andOnlyLoadAppFromAsardisabled" is a specific, checkable claim. "Feels insecure" is not. - Teaching. Every finding carries the Electron checklist item it comes from, so the recommendation is checkable rather than asserted.
Install
Zero dependencies. Python 3.8+, standard library only.
python scripts/audit.py --help
python scripts/audit.py "C:\Program Files\SomeApp\SomeApp.exe"
python scripts/audit.py ./SomeApp.app --json --markdown audit.md
python scripts/audit.py ./resources/app.asar --fail-on high
Exit codes: 0 clean at threshold, 1 findings, 2 target unreadable.
As an Agent Skill: drop the directory into your skills folder. The SKILL.md
frontmatter tells the agent when to reach for it.
Known limitations, stated plainly
- Static only. The target is never launched. Runtime decisions — which URL a window actually loaded, what the preload actually exposed, whether the server sent a CSP — are outside what bytes can tell you.
- No data-flow analysis.
openExternal(x)wherexwas validated three functions away is still reported. Treat those as "needs a human look", not proof of a bug. - Absence checks depend on scope.
ES-010,ES-015,ES-017fire on not-found. When--max-filestruncated the scan, each is markedpartial_evidence: true. - Pre-fuse builds. Electron < 12 has no fuse table. That is a finding about the Electron version, not a pass.
- One app per run. No runtime, server, or plugin-host auditing.
Re-run after each fix. The score is a progress indicator, not a target — going from 21 to 60 by deleting rules would be a worse app, not a better one.
What's inside
scripts/
audit.py entry point, scoring, text + Markdown rendering 472 lines
fuses.py fuse table locator and decoder 127 lines
fuse_map.py the nine fuses: id, safe state, severity, why 157 lines
asar.py ASAR reader (header anchor, member extraction) 173 lines
rules.py 20 rules with guards and absence checks 409 lines
references/
checklist.md the reasoning behind every rule
examples/ two real reports from shipped applications
MIT licensed. The checklist it implements is Electron's own, publicly maintained at
electronjs.org/docs/latest/tutorial/security.

Static analysis only; no runtime or data-flow state. Requires Electron 12+ for fuse decoding. Does not verify code signing signatures, only integrity flags.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
1 use
Times used to date
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 10 days ago
- Free with an Agensi account
Requires