## Что это
Content-Security-Policy для всех window'ов и embed-ов:
```
Content-Security-Policy:
default-src 'self';
script-src 'self' 'nonce-';
style-src 'self' 'nonce-';
img-src 'self' data: blob: https://rox.one;
connect-src 'self' wss://*.rox.one https://*.rox.one;
frame-src 'self' rox-design://;
frame-ancestors 'none';
report-uri /api/csp-report
```
Nonce генерируется per page-load в main process, инжектируется во все script/style теги через build pipeline (electron-builder + Vite plugin). Violations отправляются на `/api/csp-report` → audit log с category `security.csp.violation`. Threshold > 10/min → alert admin.
Компоненты: `apps/electron/src/main/csp.ts`, `apps/electron/build/csp-nonce-vite-plugin.ts`.
## Зачем
Electron-приложения исторически жертвуют CSP «потому что Electron is local». Это ошибка: malicious content в viewer (XSS через PDF, через md с inline-script) — реальный attack vector. Strict CSP с nonces — defense-in-depth даже если другие mitigations bypass.
## Источники вдохновения
- [nextdns/nextdns](https://github.com/nextdns/nextdns) — DoH proxy с per-source filtering patterns
- [unikraft/unikraft](https://github.com/unikraft/unikraft) — security primitives для isolation
- [m14r41/PentestingEverything](https://github.com/m14r41/PentestingEverything) — OWASP Top-10 checklist green
## 🔗 Linear
- [PZD-426](https://linear.app/kuhjie/issue/PZD-426) — backing ticket