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

Tauri 2.0 Fine-Grained IPC Capability Manifest & Window Isolation Standard

Enforces fine-grained permission capabilities and explicit window-to-command isolation in Tauri 2.0 configurations. Prevents arbitrary remote code execution and local privilege escalation across iOS, Android, and desktop by ensuring webviews only access explicitly scoped, cryptographically pinned IPC commands and secure origin sets.

Prohibited Anti-Pattern: Wildcard Permissions and Global IPC Command Exposure Across Unrestricted Webviews

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Fine-Grained IPC Capability Manifest & Window Isolation Standard - Enforces fine-grained permission capabilities and explicit window-to-command isolation in Tauri 2.0 configurations. Prevents arbitrary remote code execution and local privilege escalation across iOS, Android, and desktop by ensuring webviews only access explicitly scoped, cryptographically pinned IPC commands and secure origin sets.
globs: src-tauri/capabilities/**/*.json, src-tauri/capabilities/**/*.toml, src-tauri/tauri.conf.json, src-tauri/src/main.rs, src-tauri/src/lib.rs, src/**/*.{ts,tsx}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/tauri-v2-ipc-capability-manifest-standard"
---

# Tauri 2.0 Fine-Grained IPC Capability Manifest & Window Isolation Standard

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Wildcard Permissions and Global IPC Command Exposure Across Unrestricted Webviews

## System Constraints
You are a Principal Engineer and Security Architect enforcing the Tauri 2.0 Fine-Grained IPC Capability Manifest Standard. You must mandate strict least-privilege IPC capabilities across mobile and desktop targets, ensuring that webviews cannot invoke unauthorized native Rust commands or access global capabilities through wildcard declarations or improper origin mappings.

## Strict Guidelines
- Engineers MUST ALWAYS isolate distinct webviews into dedicated capability files under `src-tauri/capabilities/` with explicit window bindings.
- Engineers MUST NOT use wildcard permissions (`*:*` or `core:*`) or bind global capabilities to external remote URLs in `tauri.conf.json` or capability JSON manifests.
- Security manifests MUST restrict filesystem, shell, and native OS plugins to explicitly scoped paths using permission parameters rather than granting root access.
- Mobile-specific capabilities (camera, geolocation, biometrics, notification) MUST be mapped strictly to authorized mobile webview windows or label patterns.
- Frontend IPC invokers MUST validate payload schemas using Zod or equivalent runtime validators before calling `invoke()` to ensure command contract parity.

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

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Using wildcard window bindings ('*') combined with unconstrained permissions ('shell:allow-execute', 'fs:default') exposes full native shell and filesystem execution to any compromised webview or external frame.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default-capability",
  "description": "Insecure global capability granting all commands to any window",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "shell:allow-execute",
    "fs:default"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: Binds specific permissions exclusively to designated windows ('main', 'auth-webview') and scopes the filesystem permission to a specific non-traversable application data subdirectory without shell access.
```json
{
  "$schema": "../gen/schemas/mobile-schema.json",
  "identifier": "mobile-auth-capability",
  "description": "Scoped capability for authentication window on mobile and desktop",
  "windows": ["main", "auth-webview"],
  "permissions": [
    "core:event:allow-listen",
    "core:event:allow-emit",
    {
      "identifier": "fs:allow-read-text-file",
      "allow": [{
        "path": "$APPDATA/tokens/*"
      }]
    },
    "biometric:allow-authenticate"
  ]
}
```

### Client-Side Type-Safe IPC Invocation with Runtime Validation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Lacks payload validation and defensive error handling, allowing prototype pollution or corrupted parameters to traverse IPC boundaries unhindered.
```typescript
import { invoke } from '@tauri-apps/api/core';

// Flawed: Unchecked payload sent via raw invoke without validation or error containment
export async function executeUserPayment(data: any): Promise<void> {
  await invoke('process_payment', { payload: data });
}
```

#### Production Standard (Correct)
> **Standard**: Validates the command payload strictly at runtime before sending it across the IPC bridge, ensuring only structural contract-compliant data reaches the native Rust command.
```typescript
import { invoke } from '@tauri-apps/api/core';
import { z } from 'zod';

const PaymentPayloadSchema = z.object({
  transactionId: z.string().uuid(),
  amountInCents: z.number().int().positive(),
  currency: z.enum(['USD', 'EUR', 'GBP'])
});

export type PaymentPayload = z.infer<typeof PaymentPayloadSchema>;

export async function executeUserPayment(raw: unknown): Promise<void> {
  const payload = PaymentPayloadSchema.parse(raw);
  try {
    await invoke<void>('process_payment', { payload });
  } catch (error: unknown) {
    throw new Error(`Secure IPC 'process_payment' rejected: ${String(error)}`);
  }
}
```

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 Fine-Grained IPC Capability Manifest & Window Isolation Standard

Tauri 2.0 Fine-Grained IPC Capability Manifest & Window Isolation Standard defines an industrial-grade behavioral standard for mobile engineering. Enforces fine-grained permission capabilities and explicit window-to-command isolation in Tauri 2.0 configurations. Prevents arbitrary remote code execution and local privilege escalation across iOS, Android, and desktop by ensuring webviews only access explicitly scoped, cryptographically pinned IPC commands and secure origin sets. 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: Wildcard Permissions and Global IPC Command Exposure Across Unrestricted Webviews 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 DriftWildcard Permissions and Global IPC Command Exposure Across Unrestricted WebviewsCritical
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 distinct webviews into dedicated capability files under `src-tauri/capabilities/` with explicit window bindings.

Engineers MUST ALWAYS isolate distinct webviews into dedicated capability files under `src-tauri/capabilities/` with explicit window bindings.

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 (`*:*` or `core:*`) or bind global capabilities to external remote URLs in `tauri.conf.json` or capability JSON 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

Security manifests MUST restrict filesystem, shell, and native OS plugins to explicitly scoped paths using permission parameters rather than granting root access.

Security manifests MUST restrict filesystem, shell, and native OS plugins to explicitly scoped paths using permission parameters rather than granting root access.

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-specific capabilities (camera, geolocation, biometrics, notification) MUST be mapped strictly to authorized mobile webview windows or label patterns.

Mobile-specific capabilities (camera, geolocation, biometrics, notification) MUST be mapped strictly to authorized mobile webview windows or 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.
5

Frontend IPC invokers MUST validate payload schemas using Zod or equivalent runtime validators before calling `invoke()` to ensure command contract parity.

Frontend IPC invokers MUST validate payload schemas using Zod or equivalent runtime validators before calling `invoke()` to ensure command contract parity.

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 Fine-Grained IPC Capability Manifest & Window Isolation Standard critical for AI coding assistants?

Enforces fine-grained permission capabilities and explicit window-to-command isolation in Tauri 2.0 configurations. Prevents arbitrary remote code execution and local privilege escalation across iOS, Android, and desktop by ensuring webviews only access explicitly scoped, cryptographically pinned IPC commands and secure origin sets. 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 (Wildcard Permissions and Global IPC Command Exposure Across Unrestricted Webviews) 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