configuring-tauri-csp

Configure CSP directives in tauri.conf.json for Tauri desktop apps.

1|Updated Apr 28, 2026
One-click install
npx skills add https://github.com/nikrich/open-age --skill configuring-tauri-csp-nikrich
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: configuring-tauri-csp
Source: https://github.com/nikrich/open-age/tree/main/.claude/skills/tauri/tauri-csp
Command: npx skills add https://github.com/nikrich/open-age --skill configuring-tauri-csp-nikrich

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Content Security Policy (CSP) configuration in Tauri helps prevent XSS by restricting which scripts and resources can load, and by controlling the IPC and webview behavior in a desktop app.

Core Features & Use Cases

  • Directive configuration: Define default-src, script-src, style-src, connect-src, img-src, font-src, and more in tauri.conf.json under security.csp.
  • Security hardening: Block unauthorized scripts and external resources to reduce attack surface.
  • Use Case: Secure a Tauri app that loads remote content or uses WASM modules by whitelisting trusted origins and resource types.

Quick Start

Update tauri.conf.json to enable the CSP under the security.csp field and specify a minimal safe policy such as default-src 'self'.

Frequently Asked Questions about configuring-tauri-csp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure CSP in tauri.conf.json to prevent XSS?

Configure CSP in tauri.conf.json under security.csp by specifying directives like default-src 'self' to restrict loaded scripts and resources, preventing XSS in your Tauri webview.

What does Content Security Policy do in a Tauri desktop app?

Content Security Policy in a Tauri desktop app restricts which scripts and resources can load in the webview, controlling IPC behavior and blocking unauthorized external content to prevent XSS attacks.

Can I whitelist remote content and WASM modules in Tauri CSP?

Yes, you can whitelist remote content and WASM modules in Tauri CSP by configuring specific directives like script-src, connect-src, and img-src in tauri.conf.json to allow trusted external origins.

What CSP directives should I define for a Tauri app loading local resources?

For a Tauri app loading local resources, define CSP directives including default-src, script-src, style-src, connect-src, img-src, and font-src in tauri.conf.json to ensure only trusted sources are allowed.

How do I control inline scripts in Tauri webview security?

Control inline scripts in Tauri webview security by adjusting the script-src directive within the security.csp configuration in tauri.conf.json to explicitly permit or block inline script execution.