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

Tauri 2.0 Mobile Plugin IPC Capability Isolation Grid

Enforces strict compile-time Access Control List (ACL) manifests and fine-grained capability isolation for Tauri 2.0 mobile bridges. Prohibits global wildcards, unvalidated plugin identifiers, and ambient native API execution to prevent compromised webview contexts from invoking privileged device subsystems.

Prohibited Anti-Pattern: Wildcard Capability Manifests and Ambient IPC Bridges Exposing Native Mobile Hardware APIs

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Mobile Plugin IPC Capability Isolation Grid - Enforces strict compile-time Access Control List (ACL) manifests and fine-grained capability isolation for Tauri 2.0 mobile bridges. Prohibits global wildcards, unvalidated plugin identifiers, and ambient native API execution to prevent compromised webview contexts from invoking privileged device subsystems.
globs: src-tauri/capabilities/**/*.json, src-tauri/tauri.conf.json, src/**/*.{ts,tsx}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/tauri-v2-mobile-ipc-capability-isolation-grid"
---

# Tauri 2.0 Mobile Plugin IPC Capability Isolation Grid

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Wildcard Capability Manifests and Ambient IPC Bridges Exposing Native Mobile Hardware APIs

## System Constraints
You are a Principal Security Architect enforcing the Tauri 2.0 Mobile Plugin IPC Capability Isolation Grid. Mandate strict compile-time ACL capabilities, isolated webview window mappings, granular native permission scopes (e.g., biometric authentication, camera, filesystem), and cryptographically validated payload structures for all webview-to-native bridges. Reject any reliance on default-allow policies, wildcard permission scopes ('*:*'), or dynamic unvalidated invoke channels.

## Strict Guidelines
- Engineers MUST ALWAYS isolate mobile capabilities into dedicated JSON manifest files under `src-tauri/capabilities/` scoped strictly to target webview window labels.
- Engineers MUST NOT grant wildcard plugin permissions (such as `core:default` or `biometric:*`) in any capability manifest targeting mobile platforms.
- Code MUST strictly define explicit allow/deny ACL sets for mobile plugin commands and specific argument schemas.
- Services MUST gate native mobile invocation calls behind strongly typed client-side IPC wrappers that enforce local boundary schema validation before dispatch.
- Components NEVER invoke raw `window.__TAURI_INTERNALS__.invoke` or uncurried `@tauri-apps/api/core::invoke` directly without an intermediary, typed, and permission-isolated service layer.

## Bad vs Good Implementations
### Tauri 2.0 Mobile Capability Isolation Manifest

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Assigning permissions to wildcard windows ('*') and applying blanket default/allow-all plugin permissions allows any untrusted route or injected script inside the webview to execute high-privilege mobile hardware interfaces without argument constraint.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-capability",
  "description": "Insecure ambient mobile permissions",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "biometric:default",
    "camera:allow-all"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: Limits capabilities strictly to the verified 'main' window label, defines precise operation identifiers, explicitly denies dangerous continuous background sweeps, and constrains execution parameters via declarative schema guards.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-capability-isolated",
  "description": "Granular scoped mobile capabilities for the authenticated app webview",
  "windows": ["main"],
  "permissions": [
    {
      "identifier": "biometric:authenticate",
      "allow": [
        {
          "reason": "Verify user identity for transaction processing"
        }
      ]
    },
    "camera:deny-camera-scan-continuous",
    {
      "identifier": "camera:allow-capture-frame",
      "allow": [
        {
          "targetResolution": "1080p"
        }
      ]
    }
  ]
}
```

### Front-End Type-Safe Mobile IPC Wrapper with Boundary Validation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Directly passing untyped arguments via raw invoke strings bypasses client-side schema contracts and relies purely on native catch blocks, potentially exposing system state or crashing native bridge runtimes if malformed inputs reach IPC serialisers.
```typescript
import { invoke } from '@tauri-apps/api/core';

// Unsafe: direct invocation with raw payload and no boundary assertions
export async function captureBiometricAuth(reason: string): Promise<boolean> {
  return await invoke('plugin:biometric|authenticate', { reason });
}
```

#### Production Standard (Correct)
> **Standard**: Implements an immutable type contract, enforces strict client-side validation rules prior to dispatching across the FFI/JNI bridge, and isolates the native plugin command call behind a dedicated application service boundary.
```typescript
import { invoke } from '@tauri-apps/api/core';

interface BiometricAuthOptions {
  readonly reason: string;
  readonly timeoutMs?: number;
}

interface BiometricAuthResult {
  readonly success: boolean;
  readonly token?: string;
}

export async function captureBiometricAuth(
  options: BiometricAuthOptions
): Promise<BiometricAuthResult> {
  if (!options.reason || options.reason.length < 8) {
    throw new Error('IPC Precondition Failure: Biometric authentication reason must be explicitly detailed.');
  }

  return await invoke<BiometricAuthResult>('plugin:biometric|authenticate', {
    payload: {
      reason: options.reason,
      timeoutMs: options.timeoutMs ?? 30000,
    },
  });
}
```

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 Plugin IPC Capability Isolation Grid

Tauri 2.0 Mobile Plugin IPC Capability Isolation Grid defines an industrial-grade behavioral standard for mobile engineering. Enforces strict compile-time Access Control List (ACL) manifests and fine-grained capability isolation for Tauri 2.0 mobile bridges. Prohibits global wildcards, unvalidated plugin identifiers, and ambient native API execution to prevent compromised webview contexts from invoking privileged device 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: Wildcard Capability Manifests and Ambient IPC Bridges Exposing Native Mobile Hardware APIs 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 Capability Manifests and Ambient IPC Bridges Exposing Native Mobile Hardware APIsCritical
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 mobile capabilities into dedicated JSON manifest files under `src-tauri/capabilities/` scoped strictly to target webview window labels.

Engineers MUST ALWAYS isolate mobile capabilities into dedicated JSON manifest files under `src-tauri/capabilities/` scoped strictly to target webview window labels.

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 wildcard plugin permissions (such as `core

Engineers MUST NOT grant wildcard plugin permissions (such as `core:default` or `biometric:*`) in any capability manifest targeting mobile platforms.

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

Code MUST strictly define explicit allow/deny ACL sets for mobile plugin commands and specific argument schemas.

Code MUST strictly define explicit allow/deny ACL sets for mobile plugin commands and specific argument schemas.

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 gate native mobile invocation calls behind strongly typed client-side IPC wrappers that enforce local boundary schema validation before dispatch.

Services MUST gate native mobile invocation calls behind strongly typed client-side IPC wrappers that enforce local boundary schema validation before dispatch.

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 invoke raw `window.__TAURI_INTERNALS__.invoke` or uncurried `@tauri-apps/api/core

Components NEVER invoke raw `window.__TAURI_INTERNALS__.invoke` or uncurried `@tauri-apps/api/core::invoke` directly without an intermediary, typed, and permission-isolated service layer.

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 Plugin IPC Capability Isolation Grid critical for AI coding assistants?

Enforces strict compile-time Access Control List (ACL) manifests and fine-grained capability isolation for Tauri 2.0 mobile bridges. Prohibits global wildcards, unvalidated plugin identifiers, and ambient native API execution to prevent compromised webview contexts from invoking privileged device 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 (Wildcard Capability Manifests and Ambient IPC Bridges Exposing Native Mobile Hardware APIs) 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