Commit ce8a9ee
security: add CSP, navigation lockdown, remove bypassCSP
Electron security audit found 3 high-severity issues:
**Content Security Policy (HIGH)**:
- No CSP existed — renderer could load arbitrary external scripts.
- Added meta CSP: `default-src 'self'`, allows `connect-src https: wss:`
for API calls, `img-src/media-src data: media:` for local media,
`style-src 'unsafe-inline'` for Tailwind.
**Navigation lockdown (HIGH)**:
- No `will-navigate` or `setWindowOpenHandler` — renderer could navigate
to malicious URLs. Added `hardenWindow()` to both main and overlay
windows: blocks foreign navigation, opens external links in system
browser via `shell.openExternal()`.
**media:// bypassCSP (HIGH)**:
- Custom protocol had `bypassCSP: true`, which would nullify CSP for
media resources. Removed — media files don't need to bypass CSP.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 38b98a4 commit ce8a9ee
3 files changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
5 | 22 | | |
6 | 23 | | |
7 | 24 | | |
| |||
26 | 43 | | |
27 | 44 | | |
28 | 45 | | |
| 46 | + | |
29 | 47 | | |
30 | 48 | | |
31 | 49 | | |
| |||
71 | 89 | | |
72 | 90 | | |
73 | 91 | | |
| 92 | + | |
74 | 93 | | |
75 | 94 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
0 commit comments