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

Tauri 2.0 Granular IPC Capability ACL Hardening & Bridge Isolation

Enforces zero-trust native bridge isolation in Tauri 2.0 mobile runtimes by prohibiting wildcard permissions and unconstrained command execution. Requires explicit capability manifests mapping isolated WebView contexts to strictly scoped native commands to eliminate privilege escalation vectors into core mobile OS subsystems.

Prohibited Anti-Pattern: Unscoped Wildcard Capabilities Exposing Native Mobile OS Subsystems via Permissive IPC Bridges

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Granular IPC Capability ACL Hardening & Bridge Isolation - Enforces zero-trust native bridge isolation in Tauri 2.0 mobile runtimes by prohibiting wildcard permissions and unconstrained command execution. Requires explicit capability manifests mapping isolated WebView contexts to strictly scoped native commands to eliminate privilege escalation vectors into core mobile OS subsystems.
globs: src-tauri/capabilities/**/*.json, src-tauri/capabilities/**/*.toml, 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-granular-ipc-capability-acl-hardening"
---

# Tauri 2.0 Granular IPC Capability ACL Hardening & Bridge Isolation

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Unscoped Wildcard Capabilities Exposing Native Mobile OS Subsystems via Permissive IPC Bridges

## System Constraints
You are a Principal Security Architect enforcing Tauri 2.0 Granular IPC Capability ACL Hardening for mobile platforms (iOS and Android). You mandate zero-trust bridge configurations, fine-grained capability descriptors, and strict path/command scoping across Rust and TypeScript boundaries. Reject all wildcard plugin authorizations, unrestricted filesystem/shell access, and ambient authority patterns.

## Strict Guidelines
- Engineers MUST ALWAYS define separate, principle-of-least-privilege capability manifests in `src-tauri/capabilities/` specifically mapped to target mobile windows or WebViews by exact identifier.
- Engineers MUST NOT grant blanket or wildcard permissions (e.g., `fs:default`, `shell:all`, `http:default`) in mobile capability manifests without parameter scopes.
- Engineers MUST ALWAYS scope filesystem and native storage access to designated app sandboxes (`$APPDATA`, `$RESOURCE`, `$CACHE`) using explicit capability scope rules.
- Code SHOULD validate and sanitize all IPC arguments at both the TypeScript bridge boundary and the Rust `#[tauri::command]` entry point using strongly typed structs.
- Services MUST explicitly declare custom IPC commands inside plugin or application ACL manifests (`permissions` or `capabilities`) before invoking them over `@tauri-apps/api/core`.
- Components NEVER execute raw OS processes, mobile system intents, or unrestricted URI schemes through unverified Webview IPC invocations.

## Bad vs Good Implementations
### Tauri 2.0 Capability Manifest ACL Scoping

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Grants wildcard window access ('*') and imports whole plugin default bundles (`fs:default`, `shell:default`) without path or binary restrictions, allowing compromised mobile Webviews to access arbitrary device storage and execute shell commands.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-capability",
  "description": "Insecure permissive capability granting unrestricted device access",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "fs:default",
    "shell:default",
    "dialog:default"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: Explicitly targets only the authenticated 'main' window, disallows shell execution entirely, and bounds filesystem operations exclusively to the app data sandbox with explicit allow/deny path matchers.
```json
{
  "$schema": "../gen/schemas/mobile-schema.json",
  "identifier": "mobile-restricted-capability",
  "description": "Hardened zero-trust capability for mobile primary webview",
  "windows": ["main"],
  "permissions": [
    "core:event:default",
    {
      "identifier": "fs:allow-read-text-file",
      "allow": [
        { "path": "$APPDATA/documents/*" }
      ],
      "deny": [
        { "path": "$APPDATA/documents/*.private" }
      ]
    },
    {
      "identifier": "fs:allow-write-text-file",
      "allow": [
        { "path": "$APPDATA/documents/*" }
      ]
    }
  ]
}
```

### Strictly Scoped Frontend Bridge Invocation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Passes raw user inputs directly into native IPC commands without path sanitization or boundary verification, relying on unhardened default bridge capabilities.
```typescript
import { invoke } from '@tauri-apps/api/core';

// Flaw: ambient raw string invocation without input validation or payload typing
export async function readDeviceFile(userInputPath: string): Promise<string> {
  return await invoke<string>('plugin:fs|read_text_file', {
    path: userInputPath
  });
}
```

#### Production Standard (Correct)
> **Standard**: Enforces strict input validation before dispatch, blocks directory traversal patterns, and invokes an audited, purpose-built Rust command instead of raw low-level plugin endpoints.
```typescript
import { invoke } from '@tauri-apps/api/core';

type SafeRelativePath = string & { readonly __brand: unique symbol };

function validateDocumentPath(rawPath: string): SafeRelativePath {
  const normalized = rawPath.replace(/\\/g, '/');
  if (normalized.includes('..') || normalized.startsWith('/') || !/^[a-zA-Z0-9_-]+\.json$/.test(normalized)) {
    throw new Error('Security Violation: Invalid file path traversal pattern detected');
  }
  return normalized as SafeRelativePath;
}

export async function readSandboxedDocument(fileName: string): Promise<string> {
  const validatedName = validateDocumentPath(fileName);
  return await invoke<string>('read_user_document', {
    fileName: validatedName
  });
}
```

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 IPC Capability ACL Hardening & Bridge Isolation

Tauri 2.0 Granular IPC Capability ACL Hardening & Bridge Isolation defines an industrial-grade behavioral standard for mobile engineering. Enforces zero-trust native bridge isolation in Tauri 2.0 mobile runtimes by prohibiting wildcard permissions and unconstrained command execution. Requires explicit capability manifests mapping isolated WebView contexts to strictly scoped native commands to eliminate privilege escalation vectors into core mobile OS subsystems. 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: Unscoped Wildcard Capabilities Exposing Native Mobile OS Subsystems via Permissive IPC Bridges 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 DriftUnscoped Wildcard Capabilities Exposing Native Mobile OS Subsystems via Permissive IPC BridgesCritical
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 separate, principle-of-least-privilege capability manifests in `src-tauri/capabilities/` specifically mapped to target mobile windows or WebViews by exact identifier.

Engineers MUST ALWAYS define separate, principle-of-least-privilege capability manifests in `src-tauri/capabilities/` specifically mapped to target mobile windows or WebViews by exact identifier.

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 blanket or wildcard permissions (e.g., `fs

Engineers MUST NOT grant blanket or wildcard permissions (e.g., `fs:default`, `shell:all`, `http:default`) in mobile capability manifests without parameter scopes.

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 ALWAYS scope filesystem and native storage access to designated app sandboxes (`$APPDATA`, `$RESOURCE`, `$CACHE`) using explicit capability scope rules.

Engineers MUST ALWAYS scope filesystem and native storage access to designated app sandboxes (`$APPDATA`, `$RESOURCE`, `$CACHE`) using explicit capability scope rules.

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

Code SHOULD validate and sanitize all IPC arguments at both the TypeScript bridge boundary and the Rust `#[tauri

Code SHOULD validate and sanitize all IPC arguments at both the TypeScript bridge boundary and the Rust `#[tauri::command]` entry point using strongly typed structs.

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

Services MUST explicitly declare custom IPC commands inside plugin or application ACL manifests (`permissions` or `capabilities`) before invoking them over `@tauri-apps/api/core`.

Services MUST explicitly declare custom IPC commands inside plugin or application ACL manifests (`permissions` or `capabilities`) before invoking them over `@tauri-apps/api/core`.

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.
6

Components NEVER execute raw OS processes, mobile system intents, or unrestricted URI schemes through unverified Webview IPC invocations.

Components NEVER execute raw OS processes, mobile system intents, or unrestricted URI schemes through unverified Webview IPC invocations.

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 IPC Capability ACL Hardening & Bridge Isolation critical for AI coding assistants?

Enforces zero-trust native bridge isolation in Tauri 2.0 mobile runtimes by prohibiting wildcard permissions and unconstrained command execution. Requires explicit capability manifests mapping isolated WebView contexts to strictly scoped native commands to eliminate privilege escalation vectors into core mobile OS subsystems. 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 (Unscoped Wildcard Capabilities Exposing Native Mobile OS Subsystems via Permissive IPC Bridges) 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