Back to skill

Security audit

tauri-2-app

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Tauri app scaffolder, but some templates can generate desktop apps with under-scoped file and WebView security controls.

Before using this skill to generate a production app, tighten the generated security defaults: replace csp null with an explicit CSP, validate storage filenames or use fixed internal names, grant only the exact Tauri plugin permissions each window needs, and review updater, installer, and native open-command behavior before shipping.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
references/templates/storage-mod.md:26
Finding
Unvalidated Storage Filename Allows Path Traversal Outside the Application Data Directory<![CDATA[ ## Vulnerability Details **File Location**: `references/templates/storage-mod.md:26-27` **Vulnerability Type**: Path traversal and unrestricted filesystem access **Risk Level**: Medium ### Vulnerable Code ```rust pub fn get_storage_path(app: &AppHandle, filename: &str) -> Result<PathBuf, String> { Ok(get_app_data_dir(app)?.join(filename)) } ``` ### Technical Analysis The storage helper joins an unrestricted `filename` value directly onto the application data directory. It does not reject: - Absolute paths, which may replace the base path when passed to `PathBuf::join`. - Parent-directory components such as `../`. - Root or platform-specific path prefixes. - Paths that resolve through symbolic links outside the intended directory. The generated `load_json` and `save_json` functions use this helper for filesystem reads and writes. Although the current template primarily expects fixed internal filenames, the helper is public and is explicitly prescribed as the shared storage primitive for generated modules. If a generated command passes user- or WebView-controlled input into it, the intended app-data-directory boundary can be bypassed. This conflicts with the Skill's stated requirement that raw storage operations remain restricted to paths derived safely from `app_data_dir`. ### Attack Path 1. A generated Tauri command or module accepts a filename from the frontend. 2. A malicious or compromised WebView supplies a value such as `../../target-file` or an absolute path. 3. The command passes the value to `load_json`, `save_json`, or `get_storage_path`. 4. `get_storage_path` joins the unvalidated value with the application data directory. 5. The resulting filesystem operation reads or overwrites a file outside the intended storage directory, subject to the desktop application's operating-system permissions. No current command accepting such a filename was identified in the audited package, so exploitation depends on generated or subsequently ...[truncated 661 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Restrict storage names to a single normal path component: ```rust use std::path::{Component, Path, PathBuf}; pub fn get_storage_path(app: &AppHandle, filename: &str) -> Result<PathBuf, String> { let name = Path::new(filename); let mut components = name.components(); match (components.next(), components.next()) { (Some(Component::Normal(_)), None) => {} _ => return Err("Invalid storage filename".into()), } Ok(get_app_data_dir(app)?.join(name)) } ``` 2. If nested paths are required, explicitly reject `ParentDir`, `RootDir`, and platform prefix components. 3. Canonicalize the base directory and the destination or its existing parent, then verify that the destination remains beneath the canonical base. 4. Account for symbolic-link traversal before performing writes. 5. Prefer fixed internal filenames or a closed enum rather than accepting arbitrary strings. 6. Add tests covering `../file`, absolute paths, nested traversal, Windows path prefixes, and symbolic links. 7. Do not expose this helper directly to frontend-controlled command arguments. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/templates/tauri-conf.md:15
Finding
Production Tauri Configuration Template Disables Content Security Policy<![CDATA[ ## Vulnerability Details **File Location**: `references/templates/tauri-conf.md:15-17` **Vulnerability Type**: Missing Content Security Policy **Risk Level**: Medium ### Vulnerable Code ```json "security": { "csp": null } ``` ### Technical Analysis The source-of-truth Tauri configuration template explicitly sets the Content Security Policy to `null`. This disables CSP-based restrictions in the generated WebView. Without a restrictive CSP, injected or compromised frontend JavaScript is not constrained by policy directives governing script, connection, frame, style, and resource origins. In a Tauri application, the effect can be more serious than in a conventional website because frontend JavaScript may invoke Tauri commands and plugin APIs granted to the window. The template contradicts the Skill's own prohibition against leaving `csp: null` in production without an explicit, documented decision. The accompanying explanation treats the disabled policy as a general default rather than requiring case-specific justification. CSP is defense in depth and does not replace input validation or narrowly scoped Tauri capabilities. Nevertheless, disabling it by default removes an important mitigation against frontend injection and compromised dependencies. ### Attack Path 1. A project is generated from the template with `"csp": null`. 2. The generated frontend later develops an injection flaw, embeds unsafe remote content, or includes a compromised JavaScript dependency. 3. Attacker-controlled JavaScript executes in the main WebView without CSP restrictions. 4. The script invokes commands or plugin APIs available to the main window. 5. The attacker gains access to operations permitted by the generated capability configuration, such as file dialogs, file access, URL opening, notifications, process restart, or updater operations when those plugins are enabled. Exploitation requires a separate script-execution vector; disabling CSP increases the impact ...[truncated 726 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `csp: null` with a restrictive policy suitable for locally bundled assets. 2. Start with directives such as `default-src 'self'`, then add only the exact resource types and origins required by the generated application. 3. Do not permit arbitrary remote scripts or broad wildcard origins. 4. Add user-approved network origins only when the application genuinely loads remote resources. 5. Keep Tauri capability files narrowly scoped even when CSP is enabled. 6. Require an explicit, documented opt-out if a project cannot use CSP. 7. Add a scaffold verification check that rejects production configurations containing `"csp": null` unless a security decision is recorded. 8. Test the final policy against the generated frontend build and Tauri's actual production URL scheme. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Vague Triggers

Medium
Confidence
93% confidence
Finding
The skill instructs activation on broad, preference-based phrases like "my Tauri conventions" and even when the user does not explicitly name the skill. In an agent environment, this can cause overbroad auto-invocation, making the skill trigger in unintended contexts and increasing the chance that sensitive project files or requests are handled by a powerful scaffolding workflow without clear user intent.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger section lists broad activation conditions with no strong exclusion boundaries, so ordinary Tauri discussions or pasted feature specs could activate the skill. This creates a prompt-routing vulnerability where the agent may perform generation or environment/probing steps based on ambiguous language rather than explicit user consent.

Missing User Warnings

Low
Confidence
78% confidence
Finding
The example Tauri command accepts an arbitrary frontend-supplied path and immediately asks the OS to open it in the file manager, with no validation or indication of required user intent. In a Tauri app, backend commands are reachable from the webview, so exposing shell-triggering functionality on attacker-controlled paths can enable unexpected OS-level actions, privacy leaks about local filesystem layout, or abuse by compromised frontend code.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
references/templates/encryption-mod.md:192