Electron Security Hardening: Locking Down Your App with CSP, Sandboxing, and Least Privilege
TL;DR β An Electron app is a web page with a filesystem, a shell, and your user's credentials. The Electron security checklist from the official docs is a good start, but "good start" is not a threat model. This article walks through the four boundaries that actually matter β renderer compromise, IPC abuse, permission escalation, and navigation/link leaks β with runnable code for each fix and the mistakes that still show up in production apps.
Table of Contents
Why Desktop Apps Are a Different Attack Surface
The BrowserWindow Baseline: contextIsolation, Sandbox, and nodeIntegration
Content Security Policy That Actually Works
IPC as an Attack Surface: Channel Allowlists and Sender Validation
Permission Requests: Least Privilege at the Session Level
Navigation and Window Open: the Leakiest Defaults
The Verification Checklist
1.β¦