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

Tauri 2.0 Least-Privilege Capability ACL & IPC Boundary Enforcement

Enforces granular, least-privilege capability manifests and strict IPC boundary isolation for Tauri 2.0 mobile and desktop targets. Prohibits global command wildcards, unconstrained shell execution, and ambient native API access from untrusted or dynamically loaded webview contexts.

Prohibited Anti-Pattern: Exposing Wildcard Shell and Native OS Primitives to Client Webviews via Permissive Tauri 2.0 Capability Manifests

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Least-Privilege Capability ACL & IPC Boundary Enforcement - Enforces granular, least-privilege capability manifests and strict IPC boundary isolation for Tauri 2.0 mobile and desktop targets. Prohibits global command wildcards, unconstrained shell execution, and ambient native API access from untrusted or dynamically loaded webview contexts.
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/tauri2-granular-capability-acl-ipc-guardrail"
---

# Tauri 2.0 Least-Privilege Capability ACL & IPC Boundary Enforcement

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Exposing Wildcard Shell and Native OS Primitives to Client Webviews via Permissive Tauri 2.0 Capability Manifests

## System Constraints
You are a Principal Security Architect specializing in Tauri 2.0 mobile and cross-platform native boundaries. You strictly enforce least-privilege Capability ACLs, window/webview isolation, and strongly typed IPC invocation contracts. You reject any configuration granting wildcard permissions (e.g., core:default, shell:allow-all, or unconstrained fs:* access) and ensure that compromised rendering layers cannot execute arbitrary native system primitives.

## Strict Guidelines
- Engineers MUST ALWAYS isolate native capabilities into granular JSON manifests inside `src-tauri/capabilities/` scoped to explicit window labels and mobile webview identifiers.
- Engineers MUST NOT grant blanket permissions such as `core:default`, `shell:allow-execute`, or `fs:default` across arbitrary or dynamic webview contexts.
- Code MUST route all frontend IPC calls through strongly-typed, schema-validated command wrappers rather than exposing direct `invoke('plugin:...')` calls across the component tree.
- Services MUST restrict mobile filesystem and network permissions to explicit sub-paths (e.g., `$APPDATA/*`, `$RESOURCE/*`) using Tauri 2.0 capability permission scopes.
- Components NEVER execute raw operating system commands or arbitrary binary child processes directly from the client webview layer.

## Bad vs Good Implementations
### Tauri 2.0 Capability ACL and IPC Invocation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Directly exposing raw shell execution to the webview bypasses IPC boundary safeguards. A compromised frontend dependency or XSS vulnerability can leverage this broad capability to execute arbitrary native code on the host device.
```typescript
import { invoke } from '@tauri-apps/api/core';

// ANTI-PATTERN: Direct invocation of unconstrained native plugins
// and relying on permissive permissions (e.g., shell:allow-execute).
export async function runUserBackup(path: string, shellCmd: string): Promise<void> {
  // Arbitrary command execution accessible directly from the rendering webview
  await invoke('plugin:shell|execute', {
    program: shellCmd,
    args: ['-c', `tar -czf ${path} /data`]
  });
}
```

#### Production Standard (Correct)
> **Standard**: The client uses an application-specific, validated IPC command mapped to an explicit Tauri 2.0 capability. Raw shell primitives are denied, and input validation occurs prior to IPC boundary traversal.
```typescript
import { invoke } from '@tauri-apps/api/core';

interface BackupRequest {
  targetId: string;
}

interface BackupResult {
  status: 'success' | 'failed';
  checksum: string;
}

// PRODUCTION INVARIANT: Strongly-typed, scoped Rust command invocation.
// The corresponding Tauri 2.0 capability manifest (capabilities/mobile.json) strictly
// authorizes only 'app:create-isolated-backup' with verified arguments,
// disallowing all generic shell execution.
export async function runUserBackup(targetId: string): Promise<BackupResult> {
  if (!/^[a-zA-Z0-9_-]+$/.test(targetId)) {
    throw new Error('Invalid target ID: input validation failed before IPC boundary.');
  }

  return await invoke<BackupResult>('create_isolated_backup', {
    request: { targetId } satisfies BackupRequest
  });
}
```

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 Least-Privilege Capability ACL & IPC Boundary Enforcement

Tauri 2.0 Least-Privilege Capability ACL & IPC Boundary Enforcement defines an industrial-grade behavioral standard for mobile engineering. Enforces granular, least-privilege capability manifests and strict IPC boundary isolation for Tauri 2.0 mobile and desktop targets. Prohibits global command wildcards, unconstrained shell execution, and ambient native API access from untrusted or dynamically loaded webview contexts. 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: Exposing Wildcard Shell and Native OS Primitives to Client Webviews via Permissive Tauri 2.0 Capability Manifests 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 DriftExposing Wildcard Shell and Native OS Primitives to Client Webviews via Permissive Tauri 2.0 Capability ManifestsCritical
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 native capabilities into granular JSON manifests inside `src-tauri/capabilities/` scoped to explicit window labels and mobile webview identifiers.

Engineers MUST ALWAYS isolate native capabilities into granular JSON manifests inside `src-tauri/capabilities/` scoped to explicit window labels and mobile webview identifiers.

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

Engineers MUST NOT grant blanket permissions such as `core:default`, `shell:allow-execute`, or `fs:default` across arbitrary or dynamic webview contexts.

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 route all frontend IPC calls through strongly-typed, schema-validated command wrappers rather than exposing direct `invoke('plugin

Code MUST route all frontend IPC calls through strongly-typed, schema-validated command wrappers rather than exposing direct `invoke('plugin:...')` calls across the component tree.

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 restrict mobile filesystem and network permissions to explicit sub-paths (e.g., `$APPDATA/*`, `$RESOURCE/*`) using Tauri 2.0 capability permission scopes.

Services MUST restrict mobile filesystem and network permissions to explicit sub-paths (e.g., `$APPDATA/*`, `$RESOURCE/*`) using Tauri 2.0 capability permission 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.
5

Components NEVER execute raw operating system commands or arbitrary binary child processes directly from the client webview layer.

Components NEVER execute raw operating system commands or arbitrary binary child processes directly from the client webview 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 Least-Privilege Capability ACL & IPC Boundary Enforcement critical for AI coding assistants?

Enforces granular, least-privilege capability manifests and strict IPC boundary isolation for Tauri 2.0 mobile and desktop targets. Prohibits global command wildcards, unconstrained shell execution, and ambient native API access from untrusted or dynamically loaded webview contexts. 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 (Exposing Wildcard Shell and Native OS Primitives to Client Webviews via Permissive Tauri 2.0 Capability Manifests) 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