Commit 68bd510
committed
Security: Add CSP to Tauri webview
Content Security Policy was missing.
Context: The Tauri app ships with "csp": null, meaning zero Content Security Policy in the production webview. Any XSS vector gives an attacker unrestricted script execution with full access to Tauri IPC commands
— file system operations, network shares, everything.
Problem: A file manager handles untrusted filenames, network paths, and renders file metadata. Without CSP, a single injection point (for example, a crafted filename rendered without escaping) escalates to full
app control.
Solution: Added a restrictive CSP:
- default-src 'self' — blocks everything not explicitly allowed
- script-src 'self' — no inline scripts, no eval
- style-src 'self' 'unsafe-inline' — needed for dynamic inline styles (virtual scrolling, dialog positioning, slider ticks, CSS custom properties via setProperty)
- img-src 'self' data: — needed for base64-encoded file/app icons from the Rust backend
- connect-src 'self' https://getcmdr.com — updater endpoint (likely Rust-side, but included defensively)
- frame-src 'none'; object-src 'none' — no iframes or plugins
- base-uri 'self'; form-action 'self' — prevents base tag hijacking and form exfiltration1 parent c0d8cc3 commit 68bd510
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
0 commit comments