Skip to content

fix(tauri): enable Content Security Policy - #441

Open
louzt wants to merge 1 commit into
Fredolx:mainfrom
louzt:sec/tauri-csp-enforcement
Open

louzt wants to merge 1 commit into
Fredolx:mainfrom
louzt:sec/tauri-csp-enforcement

Conversation

@louzt

@louzt louzt commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Replaces "csp": null with a strict CSP that blocks inline scripts, external scripts, object embeddings, and frame ancestors.

What Changed

  • src-tauri/tauri.conf.json:22-24 — replaced "csp": null with strict policy

Why

Reported as #424 — Disabled CSP allows any XSS from M3U channel metadata to execute with full Tauri IPC access.

Compatibility Note

If the app uses any inline scripts or dynamic script loading, those will break. Test build recommended before merge.

Validation

cargo check passes.

Replaces \csp\: null with a strict policy:
- No inline scripts
- No external scripts except self
- No object/class embeddings
- No frame ancestors

Prevents XSS via malicious channel names or M3U metadata from
executing in the Tauri webview with IPC access.

Refs: Fredolx#424
@louzt
louzt marked this pull request as ready for review June 15, 2026 09:03
@louzt

louzt commented Jun 15, 2026

Copy link
Copy Markdown
Author

Marking this as ready for review.

The CSP is intentionally strict (script-src 'self', object-src 'none') to completely neutralize the IPC attack surface (CWE-88 and XSS via M3U metadata) reported in #424. I've explicitly allowed data: and https: for images and media to ensure HLS streams and EPG logos remain functional.

Note on Dev Environment: If your local frontend development workflow relies on WebSockets for Hot Module Replacement (HMR), or if there's any dynamic script evaluation (eval) happening in edge cases, let me know. We can easily tune the connect-src or script-src directives to accommodate it. Otherwise, this drops the Tauri webview injection risk to zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant