This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
mobilecritical PriorityID: tauri-v2-ipc-capability-scoping-standard-tauri-2-0-multi--646

Tauri 2.0 Multi-Process IPC Capability Scoping and Window Isolation Standard

Enforces strict multi-process boundary security in Tauri 2.0 mobile architectures by binding IPC command executions exclusively to isolated window capability manifests. Prevents privilege escalation across decoupled webview runtimes by disallowing wildcard permission sets and mandating cryptographic context validation per webview label.

Prohibited Anti-Pattern: Global IPC Bridge Access Permitting Cross-Webview Privilege Escalation via Shared Capabilities

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Multi-Process IPC Capability Scoping and Window Isolation Standard - Enforces strict multi-process boundary security in Tauri 2.0 mobile architectures by binding IPC command executions exclusively to isolated window capability manifests. Prevents privilege escalation across decoupled webview runtimes by disallowing wildcard permission sets and mandating cryptographic context validation per webview label.
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/tauri-v2-ipc-capability-scoping-standard-tauri-2-0-multi--646"
---

# Tauri 2.0 Multi-Process IPC Capability Scoping and Window Isolation Standard

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Global IPC Bridge Access Permitting Cross-Webview Privilege Escalation via Shared Capabilities

## System Constraints
You are a Principal Security Architect enforcing Tauri 2.0 Multi-Process IPC Capability Scoping Standards. You must reject any configuration or code that uses universal permissions (`*`), default global capabilities, or unvalidated window runtime invocations. Mandate strict cryptographic and logical boundaries between mobile webview contexts and native host execution bridges.

## Strict Guidelines
- Engineers MUST ALWAYS define granular, context-specific capability JSON files within `src-tauri/capabilities/` scoped exclusively to explicit webview label patterns.
- Engineers MUST NOT grant high-privilege plugins (e.g., `fs`, `shell`, `biometric`, `keyring`) to generic webviews or use wildcard expressions (`*`) in window mapping lists.
- Native command handlers MUST validate the calling WebviewWindow label and verify caller integrity before mutating persistent native state.
- Mobile multi-webview architectures MUST isolate untrusted content (e.g., authentication flows, in-app browser tabs) into sandboxed webviews with zero native capability attachments.
- Frontend IPC invokers MUST NOT proxy unvalidated command arguments across window boundaries via postMessage or broadcast channels.

## Bad vs Good Implementations
### Tauri 2.0 Capability Declaration: Scoped vs Permissive Global Capability

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Using wildcard window selectors ('*') assigns high-privilege native capabilities (file system access, biometric hardware) to all webview runtimes, allowing low-trust or injected webview scripts to escalate privileges.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "global-all-access",
  "description": "Anti-pattern: exposes root capabilities to every webview window",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "fs:default",
    "fs:allow-read-text-file",
    "shell:allow-open",
    "biometric:authenticate"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: Explicitly restricts the biometric authentication and scoped filesystem access permissions solely to the 'vault-secure-window' webview, preventing unauthorized runtimes from executing native actions.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "auth-vault-capability",
  "description": "Scoped capability strictly isolated to the authenticated hardware vault webview",
  "windows": ["vault-secure-window"],
  "permissions": [
    "core:default",
    {
      "identifier": "fs:allow-read-text-file",
      "allow": [{"path": "$APPDATA/vault/*"}]
    },
    "biometric:authenticate"
  ]
}
```

### Rust Command Invocation: Window Context Validation Guardrail

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The command does not verify the identity or window label of the caller, allowing arbitrary decoupled webviews with generic core capabilities to invoke sensitive operations.
```rust
// Rust Command with unvalidated runtime context
#[tauri::command]
pub async fn write_secure_token<R: tauri::Runtime>(
    _app: tauri::AppHandle<R>,
    key: String,
    secret: String,
) -> Result<(), String> {
    // Insecure: Any window invoking this command can write to persistent storage
    native_keyring::store(&key, &secret).map_err(|e| e.to_string())
}
```

#### Production Standard (Correct)
> **Standard**: Directly injects the `WebviewWindow` caller context and asserts that only the authorized runtime window label can execute the command, establishing defense-in-depth.
```rust
// Rust Command enforcing caller label isolation and capability context
#[tauri::command]
pub async fn write_secure_token<R: tauri::Runtime>(
    window: tauri::WebviewWindow<R>,
    key: String,
    secret: String,
) -> Result<(), String> {
    // Mandate strict runtime isolation: caller must be the dedicated vault window
    if window.label() != "vault-secure-window" {
        return Err("AccessDenied: Caller runtime lacks privilege for command".into());
    }
    
    native_keyring::store(&key, &secret).map_err(|e| e.to_string())
}
```

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 Multi-Process IPC Capability Scoping and Window Isolation Standard

Tauri 2.0 Multi-Process IPC Capability Scoping and Window Isolation Standard defines an industrial-grade behavioral standard for mobile engineering. Enforces strict multi-process boundary security in Tauri 2.0 mobile architectures by binding IPC command executions exclusively to isolated window capability manifests. Prevents privilege escalation across decoupled webview runtimes by disallowing wildcard permission sets and mandating cryptographic context validation per webview label. 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: Global IPC Bridge Access Permitting Cross-Webview Privilege Escalation via Shared 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 DriftGlobal IPC Bridge Access Permitting Cross-Webview Privilege Escalation via Shared 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 define granular, context-specific capability JSON files within `src-tauri/capabilities/` scoped exclusively to explicit webview label patterns.

Engineers MUST ALWAYS define granular, context-specific capability JSON files within `src-tauri/capabilities/` scoped exclusively to explicit webview label patterns.

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 high-privilege plugins (e.g., `fs`, `shell`, `biometric`, `keyring`) to generic webviews or use wildcard expressions (`*`) in window mapping lists.

Engineers MUST NOT grant high-privilege plugins (e.g., `fs`, `shell`, `biometric`, `keyring`) to generic webviews or use wildcard expressions (`*`) in window mapping lists.

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

Native command handlers MUST validate the calling WebviewWindow label and verify caller integrity before mutating persistent native state.

Native command handlers MUST validate the calling WebviewWindow label and verify caller integrity before mutating persistent native state.

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

Mobile multi-webview architectures MUST isolate untrusted content (e.g., authentication flows, in-app browser tabs) into sandboxed webviews with zero native capability attachments.

Mobile multi-webview architectures MUST isolate untrusted content (e.g., authentication flows, in-app browser tabs) into sandboxed webviews with zero native capability attachments.

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 NOT proxy unvalidated command arguments across window boundaries via postMessage or broadcast channels.

Frontend IPC invokers MUST NOT proxy unvalidated command arguments across window boundaries via postMessage or broadcast channels.

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 Multi-Process IPC Capability Scoping and Window Isolation Standard critical for AI coding assistants?

Enforces strict multi-process boundary security in Tauri 2.0 mobile architectures by binding IPC command executions exclusively to isolated window capability manifests. Prevents privilege escalation across decoupled webview runtimes by disallowing wildcard permission sets and mandating cryptographic context validation per webview label. 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 (Global IPC Bridge Access Permitting Cross-Webview Privilege Escalation via Shared 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