This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
mobilecritical PriorityID: tauri-v2-ipc-capability-scoping-standard-tauri-2-0-contex-975

Tauri 2.0 Context-Isolated IPC Capability Scoping Standard

Enforces strict compile-time capability scoping for Tauri 2.0 multi-webview mobile architectures by disallowing wildcard IPC invocation permissions and unauthenticated runtime origins. Mandates explicit window and webview label isolation paired with granular JSON capability manifests to prevent cross-webview command execution attacks.

Prohibited Anti-Pattern: Permissive Wildcard IPC Commands Across Multi-Webview Mobile Boundaries

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Context-Isolated IPC Capability Scoping Standard - Enforces strict compile-time capability scoping for Tauri 2.0 multi-webview mobile architectures by disallowing wildcard IPC invocation permissions and unauthenticated runtime origins. Mandates explicit window and webview label isolation paired with granular JSON capability manifests to prevent cross-webview command execution attacks.
globs: src-tauri/capabilities/**/*.json, src-tauri/tauri.conf.json, 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-ipc-capability-scoping-standard-tauri-2-0-contex-975"
---

# Tauri 2.0 Context-Isolated IPC Capability Scoping Standard

> **Severity**: CRITICAL | **Category**: mobile
> **Anti-Pattern Warning**: Permissive Wildcard IPC Commands Across Multi-Webview Mobile Boundaries

## System Constraints
You are a Principal Engineer and Security Architect enforcing Tauri 2.0 Context-Isolated IPC Capability Scoping Standards. Mandate compile-time capability boundaries, forbid permissive IPC command patterns ('core:*', '*'), isolate webview targets by explicit identifier, and ensure native Rust handlers validate invoke contexts against bound capability origins.

## Strict Guidelines
- Engineers MUST ALWAYS isolate mobile secondary webviews by assigning distinct, explicit window and webview labels in 'tauri.conf.json' and capability manifests.
- Engineers MUST NOT use wildcard permissions ('default', '*', 'core:default') or broad remote URL permissions inside any capability JSON file.
- Capability manifests MUST explicitly map specific commands ('core:path:default', 'app:read-secure-token') directly to explicit webview targets via the 'windows' and 'webviews' arrays.
- Native Rust command functions MUST inspect and bind 'tauri::ipc::Invoke' contexts to validated calling origins rather than trusting client-provided payloads.
- Frontend bridge clients NEVER execute '@tauri-apps/api/core.invoke' from unauthenticated third-party or iframe contexts lacking explicit Tauri capability definitions.

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

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Using wildcard window selectors ('*') paired with broad permission bundles ('core:default', 'fs:default') allows any embedded webview or malicious redirection to execute native filesystem and shell APIs.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-wildcard-capability",
  "description": "Insecure wildcard permissions across all webviews",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "fs:default",
    "shell:allow-execute"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: Binds specific network and event permissions solely to 'auth-window' and 'auth-webview' with explicit remote origin constraints, completely isolating core system APIs from untrusted execution.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "mobile-auth-isolated-capability",
  "description": "Strictly scoped permissions for authentication secondary webview",
  "windows": ["auth-window"],
  "webviews": ["auth-webview"],
  "permissions": [
    "core:event:allow-listen",
    "core:event:allow-emit",
    {
      "identifier": "http:default",
      "allow": [{ "url": "https://auth.company.internal/oauth2/v2/*" }]
    }
  ]
}
```

### Rust IPC Command Origin and Invocation Guardrail

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The command accepts raw unvalidated parameters without validating whether the caller is the privileged primary mobile webview or an untrusted external webview frame.
```rust
// Rust Command lacking webview origin checks and input validation
#[tauri::command]
pub async fn execute_mobile_transaction(amount: f64, recipient: String) -> Result<String, String> {
    // DANGEROUS: Any webview granted access to this command can invoke it without verification
    perform_transfer(amount, recipient).await
}
```

#### Production Standard (Correct)
> **Standard**: Leverages the Tauri Webview handle to explicitly verify the calling webview label against authorized execution scopes prior to processing high-privilege native logic.
```rust
// Rust Command enforcing caller identity and compile-time isolation
#[tauri::command]
pub async fn execute_mobile_transaction(
    webview: tauri::Webview,
    amount: f64,
    recipient: String
) -> Result<String, String> {
    if webview.label() != "main-mobile-webview" {
        return Err("Unauthorized webview context: IPC command denied.".into());
    }
    
    if amount <= 0.0 || recipient.trim().is_empty() {
        return Err("Invalid transaction parameters.".into());
    }

    perform_transfer(amount, recipient).await
}
```

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 Context-Isolated IPC Capability Scoping Standard

Tauri 2.0 Context-Isolated IPC Capability Scoping Standard defines an industrial-grade behavioral standard for mobile engineering. Enforces strict compile-time capability scoping for Tauri 2.0 multi-webview mobile architectures by disallowing wildcard IPC invocation permissions and unauthenticated runtime origins. Mandates explicit window and webview label isolation paired with granular JSON capability manifests to prevent cross-webview command execution attacks. 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: Permissive Wildcard IPC Commands Across Multi-Webview Mobile Boundaries 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 DriftPermissive Wildcard IPC Commands Across Multi-Webview Mobile BoundariesCritical
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 secondary webviews by assigning distinct, explicit window and webview labels in 'tauri.conf.json' and capability manifests.

Engineers MUST ALWAYS isolate mobile secondary webviews by assigning distinct, explicit window and webview labels in 'tauri.conf.json' and 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.
2

Engineers MUST NOT use wildcard permissions ('default', '*', 'core

Engineers MUST NOT use wildcard permissions ('default', '*', 'core:default') or broad remote URL permissions inside any capability JSON file.

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

Capability manifests MUST explicitly map specific commands ('core

Capability manifests MUST explicitly map specific commands ('core:path:default', 'app:read-secure-token') directly to explicit webview targets via the 'windows' and 'webviews' arrays.

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 Rust command functions MUST inspect and bind 'tauri

Native Rust command functions MUST inspect and bind 'tauri::ipc::Invoke' contexts to validated calling origins rather than trusting client-provided payloads.

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

Frontend bridge clients NEVER execute '@tauri-apps/api/core.invoke' from unauthenticated third-party or iframe contexts lacking explicit Tauri capability definitions.

Frontend bridge clients NEVER execute '@tauri-apps/api/core.invoke' from unauthenticated third-party or iframe contexts lacking explicit Tauri capability definitions.

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 Context-Isolated IPC Capability Scoping Standard critical for AI coding assistants?

Enforces strict compile-time capability scoping for Tauri 2.0 multi-webview mobile architectures by disallowing wildcard IPC invocation permissions and unauthenticated runtime origins. Mandates explicit window and webview label isolation paired with granular JSON capability manifests to prevent cross-webview command execution attacks. 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 (Permissive Wildcard IPC Commands Across Multi-Webview Mobile Boundaries) 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