This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
mobilecritical PriorityID: tauri2-capability-matrix-ipc-filter-standard

Tauri 2.0 Granular Capability Matrix Scoping and IPC Filter Standard

Enforces strict principle-of-least-privilege by cryptographically binding platform-native API access exclusively to explicit runtime window labels and URL origin contexts. Prevents cross-context privilege escalation on mobile runtimes by mandating granular capability JSON manifests with fine-grained permission arrays, explicit remote/local origin boundaries, and runtime IPC call filtering. Eliminates ambient authority by rejecting wildcard permissions, unconstrained core plugin exports, and unvalidated frontend invoke dispatches.

Prohibited Anti-Pattern: Ambient IPC Authority and Wildcard Permission Scoping in Tauri 2.0 Mobile Capabilities

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Granular Capability Matrix Scoping and IPC Filter Standard - Enforces strict principle-of-least-privilege by cryptographically binding platform-native API access exclusively to explicit runtime window labels and URL origin contexts. Prevents cross-context privilege escalation on mobile runtimes by mandating granular capability JSON manifests with fine-grained permission arrays, explicit remote/local origin boundaries, and runtime IPC call filtering. Eliminates ambient authority by rejecting wildcard permissions, unconstrained core plugin exports, and unvalidated frontend invoke dispatches.
globs: src-tauri/capabilities/**/*.json, 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/tauri2-capability-matrix-ipc-filter-standard"
---

# Tauri 2.0 Granular Capability Matrix Scoping and IPC Filter Standard

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Ambient IPC Authority and Wildcard Permission Scoping in Tauri 2.0 Mobile Capabilities

## System Constraints
You are a Principal Security Architect enforcing the Tauri 2.0 Granular Capability Matrix Scoping and IPC Filter Standard. You must ensure that all platform-native bridge invocations adhere to strict least-privilege scoping across mobile and desktop boundaries. Reject any capability manifests utilizing wildcard permission sets (e.g., 'core:default', 'fs:allow-*' without explicit path scopes) or unconstrained window/web view targets. Mandate runtime origin validation, typed IPC payloads, and zero ambient authority across all mobile webview contexts.

## Strict Guidelines
- Engineers MUST ALWAYS scope capability JSON files in `src-tauri/capabilities/` to explicit window labels (e.g., `main`, `auth-overlay`) and strict URL origins.
- Engineers MUST NOT use wildcard permissions (`*:*`, `core:default`) or unrestricted plugin sets in production mobile manifests.
- Engineers MUST explicitly restrict file system, biometrics, and camera access using fine-grained permission scopes (e.g., `fs:scope-app-data`, `biometric:authenticate-biometrics`) rather than broad plugin enablement.
- Services MUST validate IPC invocation payloads on the Rust side against cryptographically bounded schemas using `tauri::ipc::Request` and `tauri::ipc::Response` types.
- Components NEVER execute raw or dynamic string-interpolated `invoke()` commands from the frontend without typed RPC wrappers enforcing payload schema constraints.

## Bad vs Good Implementations
### Tauri 2.0 Granular Capability Manifest vs Overprivileged Wildcard

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Using wildcard window bindings ('*') and default plugin bundles grant unrestricted ambient authority. Any webview context or compromised sub-origin can execute filesystem modifications and biometric prompts without containment.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-capability",
  "description": "Capability for the entire mobile app",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "fs:default",
    "dialog:default",
    "biometric:default"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: Binds permissions strictly to the explicit window identifier ('mobile-vault-window'), limits the network origin context, and scopes file operations to a single deterministic encrypted file path while only allowing necessary biometric actions.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-secure-vault-capability",
  "description": "Least-privilege capability scoped exclusively to the authenticated vault mobile webview",
  "windows": ["mobile-vault-window"],
  "remote": {
    "urls": ["https://auth.internal.corp/*"]
  },
  "permissions": [
    "core:app:allow-version",
    "biometric:allow-authenticate-biometrics",
    {
      "identifier": "fs:allow-read-text-file",
      "allow": [{
        "path": "$APPDATA/vault-state.enc"
      }]
    }
  ]
}
```

### Rust Side IPC Command with Caller Origin & Context Validation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The Rust command blindly trusts any window invoke call without inspecting the calling window context or scoping the input path against secure app data directories.
```rust
#[tauri::command]
pub async fn read_sensitive_file(path: String) -> Result<String, String> {
    // Anti-pattern: Missing window label verification and arbitrary path read
    std::fs::read_to_string(path).map_err(|e| e.to_string())
}
```

#### Production Standard (Correct)
> **Standard**: Strictly verifies the calling `WebviewWindow` identifier against expected execution bounds and canonicalizes the path strictly within isolated app data storage.
```rust
use tauri::{ipc::Request, AppHandle, Manager, WebviewWindow};

#[tauri::command]
pub async fn read_sensitive_file(
    app: AppHandle,
    window: WebviewWindow,
    _request: Request<'_>,
) -> Result<String, String> {
    // Invariant: Verify window label matches cryptographically mapped capability
    if window.label() != "mobile-vault-window" {
        return Err("UnauthorizedContext: Command restricted to mobile-vault-window".into());
    }

    let app_data = app.path().app_data_dir().map_err(|e| e.to_string())?;
    let secure_path = app_data.join("vault-state.enc");

    tokio::fs::read_to_string(&secure_path)
        .await
        .map_err(|e| format!("StorageError: {}", e))
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

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 Granular Capability Matrix Scoping and IPC Filter Standard

Tauri 2.0 Granular Capability Matrix Scoping and IPC Filter Standard defines an industrial-grade behavioral standard for mobile engineering. Enforces strict principle-of-least-privilege by cryptographically binding platform-native API access exclusively to explicit runtime window labels and URL origin contexts. Prevents cross-context privilege escalation on mobile runtimes by mandating granular capability JSON manifests with fine-grained permission arrays, explicit remote/local origin boundaries, and runtime IPC call filtering. Eliminates ambient authority by rejecting wildcard permissions, unconstrained core plugin exports, and unvalidated frontend invoke dispatches. 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: Ambient IPC Authority and Wildcard Permission Scoping in Tauri 2.0 Mobile Capabilities 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 DriftAmbient IPC Authority and Wildcard Permission Scoping in Tauri 2.0 Mobile CapabilitiesCritical
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 scope capability JSON files in `src-tauri/capabilities/` to explicit window labels (e.g., `main`, `auth-overlay`) and strict URL origins.

Engineers MUST ALWAYS scope capability JSON files in `src-tauri/capabilities/` to explicit window labels (e.g., `main`, `auth-overlay`) and strict URL origins.

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 use wildcard permissions (`*

Engineers MUST NOT use wildcard permissions (`*:*`, `core:default`) or unrestricted plugin sets in production mobile manifests.

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 explicitly restrict file system, biometrics, and camera access using fine-grained permission scopes (e.g., `fs

Engineers MUST explicitly restrict file system, biometrics, and camera access using fine-grained permission scopes (e.g., `fs:scope-app-data`, `biometric:authenticate-biometrics`) rather than broad plugin enablement.

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

Services MUST validate IPC invocation payloads on the Rust side against cryptographically bounded schemas using `tauri

Services MUST validate IPC invocation payloads on the Rust side against cryptographically bounded schemas using `tauri::ipc::Request` and `tauri::ipc::Response` types.

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

Components NEVER execute raw or dynamic string-interpolated `invoke()` commands from the frontend without typed RPC wrappers enforcing payload schema constraints.

Components NEVER execute raw or dynamic string-interpolated `invoke()` commands from the frontend without typed RPC wrappers enforcing payload schema constraints.

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 Granular Capability Matrix Scoping and IPC Filter Standard critical for AI coding assistants?

Enforces strict principle-of-least-privilege by cryptographically binding platform-native API access exclusively to explicit runtime window labels and URL origin contexts. Prevents cross-context privilege escalation on mobile runtimes by mandating granular capability JSON manifests with fine-grained permission arrays, explicit remote/local origin boundaries, and runtime IPC call filtering. Eliminates ambient authority by rejecting wildcard permissions, unconstrained core plugin exports, and unvalidated frontend invoke dispatches. 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 (Ambient IPC Authority and Wildcard Permission Scoping in Tauri 2.0 Mobile Capabilities) 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.

Related MOBILE Rules

View all rules →
1 Rule in Stack

Tauri