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

Tauri 2.0 Scoped IPC Capability Manifest Enforcement

Enforces least-privilege IPC capability manifests and granular path scoping in Tauri 2.0 mobile applications. Unscoped IPC capabilities allow compromised WebViews to access native Android/iOS runtime APIs, bypass sandbox boundaries, and exfiltrate private mobile app storage.

Prohibited Anti-Pattern: Blanket Wildcard Plugin Permissions and Unscoped Native IPC Bindings in Mobile WebViews

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Scoped IPC Capability Manifest Enforcement - Enforces least-privilege IPC capability manifests and granular path scoping in Tauri 2.0 mobile applications. Unscoped IPC capabilities allow compromised WebViews to access native Android/iOS runtime APIs, bypass sandbox boundaries, and exfiltrate private mobile app storage.
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-scoped-ipc-capability-manifest-enforcement"
---

# Tauri 2.0 Scoped IPC Capability Manifest Enforcement

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Blanket Wildcard Plugin Permissions and Unscoped Native IPC Bindings in Mobile WebViews

## System Constraints
You are a Principal Mobile Systems Architect and Security Engineer enforcing strict Tauri 2.0 capability isolation and IPC scoping. Mandate that every IPC call, plugin invocation, and filesystem interaction is defended by least-privilege capability manifests targeting specific mobile webview windows and constrained directories.

## Strict Guidelines
- Engineers MUST ALWAYS declare explicit, fine-grained capability manifests in 'src-tauri/capabilities/' targeting specific platform contexts (e.g., 'android', 'ios') and specific window labels.
- Engineers MUST NOT grant wildcard, default, or unconstrained permissions (such as 'fs:default', 'shell:default', or 'http:default') in production capability manifests.
- Filesystem scopes MUST ALWAYS be strictly constrained to platform sandbox variables like '$APPDATA/*', '$APPCACHE/*', or '$RESOURCE/*' and MUST NOT grant recursive traversal to root filesystems.
- Services MUST validate and sanitize all command arguments on the Rust backend regardless of frontend capability checks before executing native platform operations.
- Components NEVER invoke raw, untyped Tauri IPC commands directly; all inter-process invocations MUST be encapsulated in strongly typed wrapper interfaces with runtime schema validation.

## Bad vs Good Implementations
### Mobile Capability Manifest Scoping

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Grants blanket filesystem and core permissions to all windows across all platforms without directory scoping. An XSS payload in the webview can read arbitrary private app databases or mobile storage.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-capability",
  "description": "Anti-pattern: Over-permissive wildcard access to device capabilities",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "fs:default",
    "fs:allow-read",
    "fs:allow-write"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: Restricts permissions specifically to mobile targets ('android', 'ios') and the 'main' window, strictly limiting filesystem operations to the isolated '$APPDATA/documents/*' subdirectory.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-capability",
  "description": "Least-privilege scoped permissions for mobile runtime sandbox",
  "platforms": ["android", "ios"],
  "windows": ["main"],
  "permissions": [
    "core:path:default",
    {
      "identifier": "fs:allow-read-text-file",
      "allow": [
        { "path": "$APPDATA/documents/*" }
      ]
    },
    {
      "identifier": "fs:allow-write-text-file",
      "allow": [
        { "path": "$APPDATA/documents/*" }
      ]
    }
  ]
}
```

### Typed and Validated IPC Frontend Client Wrapper

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Invokes the native bridge without input validation or sandbox constraint enforcement, inviting path traversal and uncontrolled bridge abuse.
```typescript
import { invoke } from '@tauri-apps/api/core';

// Bad: Raw, untyped invocation passing unvalidated path payload
export async function readDoc(fileName: string) {
  return await invoke('plugin:fs|read_text_file', { path: fileName });
}
```

#### Production Standard (Correct)
> **Standard**: Enforces strict parameter sanitization before IPC dispatch, resolving paths against safe mobile application directory targets compliant with manifest scopes.
```typescript
import { invoke } from '@tauri-apps/api/core';
import { appDataDir, join } from '@tauri-apps/api/path';

const SAFE_FILENAME_REGEX = /^[a-zA-Z0-9_\-]+\.txt$/;

export async function readMobileDocument(fileName: string): Promise<string> {
  if (!SAFE_FILENAME_REGEX.test(fileName)) {
    throw new Error('Invalid file name: traversal tokens are prohibited');
  }
  const baseDir = await appDataDir();
  const safePath = await join(baseDir, 'documents', fileName);
  
  return await invoke<string>('plugin:fs|read_text_file', {
    path: safePath
  });
}
```

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Tauri 2.0 Scoped IPC Capability Manifest Enforcement

Tauri 2.0 Scoped IPC Capability Manifest Enforcement defines an industrial-grade behavioral standard for mobile engineering. Enforces least-privilege IPC capability manifests and granular path scoping in Tauri 2.0 mobile applications. Unscoped IPC capabilities allow compromised WebViews to access native Android/iOS runtime APIs, bypass sandbox boundaries, and exfiltrate private mobile app storage. 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: Blanket Wildcard Plugin Permissions and Unscoped Native IPC Bindings in Mobile 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 DriftBlanket Wildcard Plugin Permissions and Unscoped Native IPC Bindings in Mobile 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 declare explicit, fine-grained capability manifests in 'src-tauri/capabilities/' targeting specific platform contexts (e.g., 'android', 'ios') and specific window labels.

Engineers MUST ALWAYS declare explicit, fine-grained capability manifests in 'src-tauri/capabilities/' targeting specific platform contexts (e.g., 'android', 'ios') and specific 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, default, or unconstrained permissions (such as 'fs

Engineers MUST NOT grant wildcard, default, or unconstrained permissions (such as 'fs:default', 'shell:default', or 'http:default') in production capability 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

Filesystem scopes MUST ALWAYS be strictly constrained to platform sandbox variables like '$APPDATA/*', '$APPCACHE/*', or '$RESOURCE/*' and MUST NOT grant recursive traversal to root filesystems.

Filesystem scopes MUST ALWAYS be strictly constrained to platform sandbox variables like '$APPDATA/*', '$APPCACHE/*', or '$RESOURCE/*' and MUST NOT grant recursive traversal to root filesystems.

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 validate and sanitize all command arguments on the Rust backend regardless of frontend capability checks before executing native platform operations.

Services MUST validate and sanitize all command arguments on the Rust backend regardless of frontend capability checks before executing native platform operations.

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, untyped Tauri IPC commands directly

Components NEVER invoke raw, untyped Tauri IPC commands directly; all inter-process invocations MUST be encapsulated in strongly typed wrapper interfaces with runtime schema validation.

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 Scoped IPC Capability Manifest Enforcement critical for AI coding assistants?

Enforces least-privilege IPC capability manifests and granular path scoping in Tauri 2.0 mobile applications. Unscoped IPC capabilities allow compromised WebViews to access native Android/iOS runtime APIs, bypass sandbox boundaries, and exfiltrate private mobile app storage. 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 (Blanket Wildcard Plugin Permissions and Unscoped Native IPC Bindings in Mobile 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