This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: tauri-2-ipc-permission-capability-scope-standard

Tauri 2.0 IPC Zero-Trust Permission Capability & Scoping Standard

Enforces fine-grained capability definitions and path/parameter scoping across the Tauri 2.0 WebView-to-Rust IPC boundary. Prohibits global wildcard permissions, unconstrained shell execution, and unsanitized command handlers that risk arbitrary native host code execution.

Prohibited Anti-Pattern: Blanket Capability Declarations and Wildcard Command Scopes in Tauri 2.0 IPC Manifests

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 IPC Zero-Trust Permission Capability & Scoping Standard - Enforces fine-grained capability definitions and path/parameter scoping across the Tauri 2.0 WebView-to-Rust IPC boundary. Prohibits global wildcard permissions, unconstrained shell execution, and unsanitized command handlers that risk arbitrary native host code execution.
globs: src-tauri/capabilities/**/*.json, src-tauri/capabilities/**/*.toml, src-tauri/tauri.conf.json, src-tauri/src/**/*.rs, src/**/*.{ts,tsx}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/tauri-2-ipc-permission-capability-scope-standard"
---

# Tauri 2.0 IPC Zero-Trust Permission Capability & Scoping Standard

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Blanket Capability Declarations and Wildcard Command Scopes in Tauri 2.0 IPC Manifests

## System Constraints
You are a Principal Security Architect enforcing the Tauri 2.0 IPC Permission Capability Scope Standard. Tauri 2.x introduces a granular permission and capability model replacing the v1 allowlist. You must enforce zero-trust isolation between frontend WebViews and native Rust code: reject all global wildcards, mandate strict origin mapping, require explicit argument constraints (scopes) for file system and shell operations, and prohibit direct pass-through of client-controlled arguments to native child processes or Rust system calls.

## Strict Guidelines
- Engineers MUST ALWAYS isolate capabilities into separate JSON/TOML files within `src-tauri/capabilities/` scoped strictly to specific window labels.
- Engineers MUST NOT grant wildcard permissions such as `core:default`, `fs:allow-all`, `shell:allow-execute`, or `shell:all` in any production capability manifest.
- Engineers MUST configure fine-grained scopes when declaring filesystem (`fs`) or child-process (`shell`) permissions, explicitly constraining accessible paths using canonical system path variables (e.g., `$APPDATA/*`).
- Rust IPC command handlers (`#[tauri::command]`) MUST validate and sanitize all dynamic arguments independently of frontend-provided schemas before performing native operations.
- Frontend IPC invokers MUST ONLY call typed commands through `@tauri-apps/api/core` via strictly defined parameter contracts; direct reflection or string interpolation in invoke calls is FORBIDDEN.

## Bad vs Good Implementations
### Tauri 2.0 Capability Manifest Configuration

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Grants complete read/write access to the host filesystem and unconstrained child process execution to all windows. Compromising any WebView context immediately yields native Remote Code Execution (RCE).
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "main-capability",
  "description": "Capability for the main window with excessive privileges",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "fs:default",
    "fs:allow-all",
    "shell:default",
    "shell:allow-execute"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: Binds permissions strictly to the 'main' window label and limits filesystem operations to the application data directory with restrictive glob patterns, neutralizing path-traversal attacks.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "main-window-capability",
  "description": "Strictly scoped permissions for main window operations",
  "windows": ["main"],
  "permissions": [
    "core:event:default",
    {
      "identifier": "fs:allow-read-text-file",
      "allow": [
        { "path": "$APPDATA/reports/**" }
      ]
    },
    {
      "identifier": "fs:allow-write-text-file",
      "allow": [
        { "path": "$APPDATA/reports/*.json" }
      ]
    }
  ]
}
```

### Rust IPC Handler Argument Validation and Privilege Isolation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Bypasses Tauri 2.0 security boundaries by calling std::process::Command directly with unsanitized parameters, enabling arbitrary binary execution on the host.
```rust
use std::process::Command;

#[tauri::command]
pub fn execute_custom_tool(tool_name: String, user_input: String) -> Result<String, String> {
    // Directly executing user-controlled strings invokes shell injection vulnerabilities
    let output = Command::new(&tool_name)
        .arg(&user_input)
        .output()
        .map_err(|e| e.to_string())?;

    Ok(String::from_utf8_lossy(&output.stdout).to_string())
}
```

#### Production Standard (Correct)
> **Standard**: Uses canonicalized Tauri AppHandle paths, forbids directory traversal sequences explicitly, and eliminates generic shell invocation in favor of safe, isolated standard library file APIs.
```rust
use std::path::PathBuf;
use tauri::Manager;

#[derive(serde::Deserialize)]
pub struct ExportReportRequest {
    pub file_name: String,
    pub payload: String,
}

#[tauri::command]
pub async fn export_report(
    app: tauri::AppHandle,
    request: ExportReportRequest,
) -> Result<(), String> {
    // Validate against path traversal
    if request.file_name.contains('/') || request.file_name.contains('\\') || request.file_name.contains("..") {
        return Err("Invalid file name identifier".into());
    }

    let app_dir = app.path().app_data_dir().map_err(|e| e.to_string())?;
    let safe_path: PathBuf = app_dir.join("reports").join(&request.file_name);

    tokio::fs::write(&safe_path, request.payload.as_bytes())
        .await
        .map_err(|e| e.to_string())?;

    Ok(())
}
```

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Tauri 2.0 IPC Zero-Trust Permission Capability & Scoping Standard

Tauri 2.0 IPC Zero-Trust Permission Capability & Scoping Standard defines an industrial-grade behavioral standard for security engineering. Enforces fine-grained capability definitions and path/parameter scoping across the Tauri 2.0 WebView-to-Rust IPC boundary. Prohibits global wildcard permissions, unconstrained shell execution, and unsanitized command handlers that risk arbitrary native host code execution. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Blanket Capability Declarations and Wildcard Command Scopes in Tauri 2.0 IPC Manifests Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftBlanket Capability Declarations and Wildcard Command Scopes in Tauri 2.0 IPC ManifestsCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS isolate capabilities into separate JSON/TOML files within `src-tauri/capabilities/` scoped strictly to specific window labels.

Engineers MUST ALWAYS isolate capabilities into separate JSON/TOML files within `src-tauri/capabilities/` scoped strictly to specific window labels.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT grant wildcard permissions such as `core

Engineers MUST NOT grant wildcard permissions such as `core:default`, `fs:allow-all`, `shell:allow-execute`, or `shell:all` in any production capability manifest.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Engineers MUST configure fine-grained scopes when declaring filesystem (`fs`) or child-process (`shell`) permissions, explicitly constraining accessible paths using canonical system path variables (e.g., `$APPDATA/*`).

Engineers MUST configure fine-grained scopes when declaring filesystem (`fs`) or child-process (`shell`) permissions, explicitly constraining accessible paths using canonical system path variables (e.g., `$APPDATA/*`).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Rust IPC command handlers (`#[tauri

Rust IPC command handlers (`#[tauri::command]`) MUST validate and sanitize all dynamic arguments independently of frontend-provided schemas before performing native operations.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Frontend IPC invokers MUST ONLY call typed commands through `@tauri-apps/api/core` via strictly defined parameter contracts

Frontend IPC invokers MUST ONLY call typed commands through `@tauri-apps/api/core` via strictly defined parameter contracts; direct reflection or string interpolation in invoke calls is FORBIDDEN.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Tauri 2.0 IPC Zero-Trust Permission Capability & Scoping Standard critical for AI coding assistants?

Enforces fine-grained capability definitions and path/parameter scoping across the Tauri 2.0 WebView-to-Rust IPC boundary. Prohibits global wildcard permissions, unconstrained shell execution, and unsanitized command handlers that risk arbitrary native host code execution. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Blanket Capability Declarations and Wildcard Command Scopes in Tauri 2.0 IPC Manifests) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Tauri