This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
mobilecritical PriorityID: tauri-2-0-mobile-ipc-permissions-scope-production-standard

Tauri 2.0 Mobile IPC & Capabilities Permissions Matrix Standard

Tauri v2 introduces a capability-driven permissions system replacing legacy v1 allowlists across iOS and Android runtimes. Failure to constrain IPC command handlers with typed schemas and explicit mobile capability definitions exposes native mobile OS surfaces to arbitrary code execution, permission leakage, and silent serialization failures. Production mobile deployments require strictly typed IPC boundary validation, granular capability scopes, and graceful permission degradation.

Prohibited Anti-Pattern: Hallucinating deprecated Tauri v1 allowlists or executing unsanitized IPC commands across mobile webviews without capability scoping.

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Mobile IPC & Capabilities Permissions Matrix Standard - Tauri v2 introduces a capability-driven permissions system replacing legacy v1 allowlists across iOS and Android runtimes. Failure to constrain IPC command handlers with typed schemas and explicit mobile capability definitions exposes native mobile OS surfaces to arbitrary code execution, permission leakage, and silent serialization failures. Production mobile deployments require strictly typed IPC boundary validation, granular capability scopes, and graceful permission degradation.
globs: src-tauri/capabilities/**/*.json, src-tauri/src/**/*.rs, src/**/*.ts, src/**/*.tsx
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/tauri-2-0-mobile-ipc-permissions-scope-production-standard"
---

# Tauri 2.0 Mobile IPC & Capabilities Permissions Matrix Standard

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Hallucinating deprecated Tauri v1 allowlists or executing unsanitized IPC commands across mobile webviews without capability scoping.

## System Constraints
You are a Principal Mobile Architect specializing in Tauri 2.0 iOS and Android development. Enforce strict capability boundaries in JSON configurations and validate all frontend-to-Rust IPC invocations with typed schemas. Reject deprecated Tauri v1 patterns, unsanitized IPC arguments, and unconstrained native plugin permissions.

## Strict Guidelines
- Mobile capabilities MUST be defined in `src-tauri/capabilities/*.json` using explicit platform targets (`android`, `ios`) and targeted permission identifiers instead of wildcard scopes.
- Frontend IPC invocations MUST validate payloads using strict runtime validation (such as Zod) before dispatching to `core.invoke()` to avoid panics in native Rust bindings.
- Custom native mobile commands MUST deserialize payloads into explicit Rust structs with bounded types and MUST NOT accept arbitrary raw JSON values.
- Native device operations (biometrics, secure storage, camera) MUST verify runtime permissions before invoking native plugin methods and handle platform denials gracefully.
- Developers MUST NOT use deprecated Tauri v1 `allowlist` settings in `tauri.conf.json`, as they are silently ignored and leave Tauri v2 mobile platforms misconfigured.

## Bad vs Good Implementations
### Tauri 2.0 Mobile IPC Payload Validation and Capability Scoping

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: This code passes unvalidated, untyped user input across the IPC bridge to the native layer. On mobile devices, unconstrained paths can trigger path traversal vulnerabilities or native panics. It lacks compile-time return types and runtime error demarcation required by Tauri 2.0 capabilities.
```typescript
import { invoke } from '@tauri-apps/api/core';

// Anti-pattern: Untyped invoke, bypasses capability validation, allows path traversal
export async function writeMobileFile(filePath: string, fileData: any): Promise<any> {
  return await invoke('write_device_storage', {
    path: filePath,
    data: fileData,
  });
}
```

#### Production Standard (Correct)
> **Standard**: Validates the payload before crossing the IPC bridge with a restrictive Zod schema (preventing path traversal and unexpected types), targets a namespaced Tauri 2.0 capability-scoped plugin command, provides explicit generic typing for the native response, and wraps native bridge failures safely.
```typescript
import { invoke } from '@tauri-apps/api/core';
import { z } from 'zod';

const StoragePayloadSchema = z.object({
  fileName: z.string().regex(/^[a-zA-Z0-9._-]{1,64}\.dat$/),
  contentBase64: z.string().min(1),
});

export type StoragePayload = z.infer<typeof StoragePayloadSchema>;

export interface StorageWriteResult {
  success: boolean;
  bytesWritten: number;
}

export async function writeMobileFileSafe(rawInput: unknown): Promise<StorageWriteResult> {
  const parseResult = StoragePayloadSchema.safeParse(rawInput);
  if (!parseResult.success) {
    throw new Error(`Invalid storage payload: ${parseResult.error.message}`);
  }

  try {
    return await invoke<StorageWriteResult>('plugin:secure-storage|write_device_storage', {
      payload: parseResult.data,
    });
  } catch (error: unknown) {
    const message = error instanceof Error ? error.message : String(error);
    throw new Error(`Mobile native write failed: ${message}`);
  }
}
```

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 Mobile IPC & Capabilities Permissions Matrix Standard

Tauri 2.0 Mobile IPC & Capabilities Permissions Matrix Standard defines an industrial-grade behavioral standard for mobile engineering. Tauri v2 introduces a capability-driven permissions system replacing legacy v1 allowlists across iOS and Android runtimes. Failure to constrain IPC command handlers with typed schemas and explicit mobile capability definitions exposes native mobile OS surfaces to arbitrary code execution, permission leakage, and silent serialization failures. Production mobile deployments require strictly typed IPC boundary validation, granular capability scopes, and graceful permission degradation. 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: Hallucinating deprecated Tauri v1 allowlists or executing unsanitized IPC commands across mobile webviews without capability scoping. 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 DriftHallucinating deprecated Tauri v1 allowlists or executing unsanitized IPC commands across mobile webviews without capability scoping.Critical
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

Mobile capabilities MUST be defined in `src-tauri/capabilities/*.json` using explicit platform targets (`android`, `ios`) and targeted permission identifiers instead of wildcard scopes.

Mobile capabilities MUST be defined in `src-tauri/capabilities/*.json` using explicit platform targets (`android`, `ios`) and targeted permission identifiers instead of wildcard 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.
2

Frontend IPC invocations MUST validate payloads using strict runtime validation (such as Zod) before dispatching to `core.invoke()` to avoid panics in native Rust bindings.

Frontend IPC invocations MUST validate payloads using strict runtime validation (such as Zod) before dispatching to `core.invoke()` to avoid panics in native Rust 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.
3

Custom native mobile commands MUST deserialize payloads into explicit Rust structs with bounded types and MUST NOT accept arbitrary raw JSON values.

Custom native mobile commands MUST deserialize payloads into explicit Rust structs with bounded types and MUST NOT accept arbitrary raw JSON values.

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

Native device operations (biometrics, secure storage, camera) MUST verify runtime permissions before invoking native plugin methods and handle platform denials gracefully.

Native device operations (biometrics, secure storage, camera) MUST verify runtime permissions before invoking native plugin methods and handle platform denials gracefully.

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

Developers MUST NOT use deprecated Tauri v1 `allowlist` settings in `tauri.conf.json`, as they are silently ignored and leave Tauri v2 mobile platforms misconfigured.

Developers MUST NOT use deprecated Tauri v1 `allowlist` settings in `tauri.conf.json`, as they are silently ignored and leave Tauri v2 mobile platforms misconfigured.

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 Mobile IPC & Capabilities Permissions Matrix Standard critical for AI coding assistants?

Tauri v2 introduces a capability-driven permissions system replacing legacy v1 allowlists across iOS and Android runtimes. Failure to constrain IPC command handlers with typed schemas and explicit mobile capability definitions exposes native mobile OS surfaces to arbitrary code execution, permission leakage, and silent serialization failures. Production mobile deployments require strictly typed IPC boundary validation, granular capability scopes, and graceful permission degradation. 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 (Hallucinating deprecated Tauri v1 allowlists or executing unsanitized IPC commands across mobile webviews without capability scoping.) 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