This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: tauri-v2-multi-webview-ipc-capability-scoping-standard

Tauri 2.0 Multi-WebView IPC Capability Scoping & Manifest Isolation Standard

Enforces strict window-level and webview-level IPC permission scoping within Tauri 2.0 capability manifests to eliminate privilege escalation vectors across multi-window architectures. Restricts IPC commands, plugins, and remote URL access to explicit window identifiers and cryptographically verified contexts rather than shared or wildcard execution envelopes.

Prohibited Anti-Pattern: Global Window Wildcards and Unscoped IPC Permissions Across Multi-WebView Desktop Contexts

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tauri 2.0 Multi-WebView IPC Capability Scoping & Manifest Isolation Standard - Enforces strict window-level and webview-level IPC permission scoping within Tauri 2.0 capability manifests to eliminate privilege escalation vectors across multi-window architectures. Restricts IPC commands, plugins, and remote URL access to explicit window identifiers and cryptographically verified contexts rather than shared or wildcard execution envelopes.
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-multi-webview-ipc-capability-scoping-standard"
---

# Tauri 2.0 Multi-WebView IPC Capability Scoping & Manifest Isolation Standard

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Global Window Wildcards and Unscoped IPC Permissions Across Multi-WebView Desktop Contexts

## System Constraints
You are a Principal Security Architect enforcing the Tauri 2.0 Multi-WebView IPC Capability Scoping Standard. Your objective is to eliminate cross-window privilege escalation, malicious IPC command invocation from untrusted webviews, and blanket capability inheritance. Every secondary window, webview partition, or remote-facing frame must be assigned a dedicated, least-privilege capability file with strict window matching and explicit command allowances.

## Strict Guidelines
- Engineers MUST ALWAYS isolate capabilities into discrete files in `src-tauri/capabilities/*.json` mapped to exact window labels (e.g., `"windows": ["main"]`), never using wildcard patterns like `"windows": ["*"]`.
- Engineers MUST NOT grant file-system (`fs:*`), process-execution (`shell:*`), or database capabilities to auxiliary, OAuth, preview, or untrusted secondary webview windows.
- Engineers MUST explicitly define remote URL security boundaries within `remote` capability blocks, using origin-pinned HTTPS endpoints instead of broad domain wildcards.
- Custom Rust IPC commands MUST check caller identity using `tauri::ipc::Request` or inspect window labels (`window.label()`) when mutating sensitive application state or executing OS-level primitives.
- Frontend IPC invokers MUST type-check payloads and adhere strictly to capability-scoped interfaces using generated bindings or strictly mapped IPC schemas.

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

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Using wildcard window bindings ('*') allows any created window or dynamic webview (e.g., auth popups, untrusted external previews) full access to privileged filesystem and shell execution commands.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default-capability",
  "description": "Shared capability for all application windows",
  "windows": ["*"],
  "permissions": [
    "core:default",
    "fs:allow-read-text-file",
    "fs:allow-write-text-file",
    "shell:allow-open",
    "shell:allow-execute"
  ]
}
```

#### Production Standard (Correct)
> **Standard**: The capability explicitly binds solely to 'document-preview-window' with origin-pinned HTTPS remote access and minimal permissions (event listening, hide), completely omitting filesystem and shell capabilities.
```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "untrusted-preview-capability",
  "description": "Restricted capability envelope for secondary preview webviews",
  "windows": ["document-preview-window"],
  "remote": {
    "urls": ["https://preview.internal.corp/*"]
  },
  "permissions": [
    "core:event:allow-listen",
    "core:webview:allow-hide"
  ]
}
```

### Rust IPC Command Window Context Validation

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The command performs destructive filesystem modifications without verifying which window or webview originated the IPC invoke call.
```rust
#[tauri::command]
pub async fn delete_workspace_vault(vault_id: String) -> Result<(), String> {
    // Anti-pattern: Blindly executes privileged operation regardless of calling window label
    std::fs::remove_dir_all(format!("/var/vaults/{}", vault_id))
        .map_err(|e| e.to_string())?;
    Ok(())
}
```

#### Production Standard (Correct)
> **Standard**: The command validates that the caller window matches 'main-admin-window' before executing and guards against path traversal.
```rust
#[tauri::command]
pub async fn delete_workspace_vault(
    window: tauri::WebviewWindow,
    vault_id: String
) -> Result<(), String> {
    // Invariant: Enforce explicit caller context authorization
    if window.label() != "main-admin-window" {
        return Err("Unauthorized IPC invocation from secondary context".into());
    }

    let safe_path = std::path::Path::new("/var/vaults").join(&vault_id);
    if !safe_path.starts_with("/var/vaults/") {
        return Err("Path traversal detected".into());
    }

    tokio::fs::remove_dir_all(safe_path)
        .await
        .map_err(|e| format!("Failed to delete vault: {}", e))?;

    Ok(())
}
```

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 Multi-WebView IPC Capability Scoping & Manifest Isolation Standard

Tauri 2.0 Multi-WebView IPC Capability Scoping & Manifest Isolation Standard defines an industrial-grade behavioral standard for security engineering. Enforces strict window-level and webview-level IPC permission scoping within Tauri 2.0 capability manifests to eliminate privilege escalation vectors across multi-window architectures. Restricts IPC commands, plugins, and remote URL access to explicit window identifiers and cryptographically verified contexts rather than shared or wildcard execution envelopes. 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: Global Window Wildcards and Unscoped IPC Permissions Across Multi-WebView Desktop Contexts 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 DriftGlobal Window Wildcards and Unscoped IPC Permissions Across Multi-WebView Desktop ContextsCritical
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 capabilities into discrete files in `src-tauri/capabilities/*.json` mapped to exact window labels (e.g., `"windows"

Engineers MUST ALWAYS isolate capabilities into discrete files in `src-tauri/capabilities/*.json` mapped to exact window labels (e.g., `"windows": ["main"]`), never using wildcard patterns like `"windows": ["*"]`.

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 file-system (`fs

Engineers MUST NOT grant file-system (`fs:*`), process-execution (`shell:*`), or database capabilities to auxiliary, OAuth, preview, or untrusted secondary webview windows.

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

Engineers MUST explicitly define remote URL security boundaries within `remote` capability blocks, using origin-pinned HTTPS endpoints instead of broad domain wildcards.

Engineers MUST explicitly define remote URL security boundaries within `remote` capability blocks, using origin-pinned HTTPS endpoints instead of broad domain wildcards.

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

Custom Rust IPC commands MUST check caller identity using `tauri

Custom Rust IPC commands MUST check caller identity using `tauri::ipc::Request` or inspect window labels (`window.label()`) when mutating sensitive application state or executing OS-level primitives.

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 IPC invokers MUST type-check payloads and adhere strictly to capability-scoped interfaces using generated bindings or strictly mapped IPC schemas.

Frontend IPC invokers MUST type-check payloads and adhere strictly to capability-scoped interfaces using generated bindings or strictly mapped IPC 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.
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 Multi-WebView IPC Capability Scoping & Manifest Isolation Standard critical for AI coding assistants?

Enforces strict window-level and webview-level IPC permission scoping within Tauri 2.0 capability manifests to eliminate privilege escalation vectors across multi-window architectures. Restricts IPC commands, plugins, and remote URL access to explicit window identifiers and cryptographically verified contexts rather than shared or wildcard execution envelopes. 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 (Global Window Wildcards and Unscoped IPC Permissions Across Multi-WebView Desktop Contexts) 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