Token导航 LogoToken导航TokenDH.com
前端设计操作浏览器github未标认证来源可访问clear审计通过

understanding-tauri-process-modelunderstanding Tauri process model 安全

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

1,505

周安装

64

GitHub Stars

18

下载量

527
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:understanding-tauri-process-model(understanding Tauri process model 安全)
来源仓库:https://github.com/dchuk/claude-code-tauri-skills
仓库路径:skills/understanding-tauri-process-model
安装命令:
npx skills add https://github.com/dchuk/claude-code-tauri-skills --skill understanding-tauri-process-model
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/dchuk/claude-code-tauri-skills --skill understanding-tauri-process-model

简介

Tauri 进程模型分离受信任的核心进程与不受信任的 WebView。

  • 所有系统操作应在 Core 进程中实现并通过 IPC 通信。
  • WebView 仅作为表现层,降低攻击面。
  • 适合构建高安全性桌面应用的基础模型。understanding-tauri-process-model 属于前端设计类 Skill,可作为该场景下的辅助能力补充。
  • 需严格遵循最小权限原则配置功能和权限。

SKILL.md

Tauri Process Model

Tauri implements a multi-process architecture similar to Electron and modern web browsers. Understanding this model is essential for building secure, performant Tauri applications.

Architecture Overview

+------------------------------------------------------------------+
|                        TAURI APPLICATION                          |
+------------------------------------------------------------------+
|                                                                   |
|  +-----------------------------+                                  |
|  |       CORE PROCESS          |                                  |
|  |         (Rust)              |                                  |
|  |                             |                                  |
|  |  +----------------------+   |                                  |
|  |  | Window Manager       |   |                                  |
|  |  +----------------------+   |                                  |
|  |  | System Tray          |   |                                  |
|  |  +----------------------+   |                                  |
|  |  | Global State         |   |                                  |
|  |  +----------------------+   |                                  |
|  |  | IPC Router           |   |                                  |
|  |  +----------------------+   |                                  |
|  |  | OS Abstractions      |   |                                  |
|  +-------------+---------------+                                  |
|                |                                                  |
|                | IPC (Inter-Process Communication)                |
|                |                                                  |
|     +----------+----------+----------+                            |
|     |          |          |          |                            |
|     v          v          v          v                            |
|  +------+  +------+  +------+  +------+                           |
|  |WebView|  |WebView|  |WebView|  |WebView|                       |
|  |  #1   |  |  #2   |  |  #3   |  |  #N   |                       |
|  +------+  +------+  +------+  +------+                           |
|  | HTML |  | HTML |  | HTML |  | HTML |                           |
|  | CSS  |  | CSS  |  | CSS  |  | CSS  |                           |
|  | JS   |  | JS   |  | JS   |  | JS   |                           |
|  +------+  +------+  +------+  +------+                           |
|                                                                   |
+------------------------------------------------------------------+

The Core Process

The Core process is the application's entry point and central hub. It runs Rust code and has exclusive access to operating system capabilities.

Responsibilities

ResponsibilityDescription
Window ManagementCreates and orchestrates application windows
System IntegrationManages system tray menus and notifications
IPC RoutingHandles all inter-process communication
Global StateManages application-wide settings and database connections
OS AbstractionsProvides cross-platform APIs

Why Rust for the Core Process

Rust powers the Core process for its memory-safety guarantees. The ownership system prevents:

  • Null pointer dereferences
  • Buffer overflows
  • Data races
  • Use-after-free bugs

This is critical because the Core process has full system access.

+------------------------------------------+
|            CORE PROCESS                   |
|                                          |
|  Memory Safety via Rust Ownership:       |
|  - No null pointers                      |
|  - No buffer overflows                   |
|  - No data races                         |
|  - No use-after-free                     |
|                                          |
|  Full OS Access:                         |
|  - File system                           |
|  - Network                               |
|  - System APIs                           |
|  - Hardware interfaces                   |
+------------------------------------------+

The WebView Process

WebView processes render the user interface using the operating system's native WebView library.

Platform-Specific WebViews

+------------------+------------------+------------------+
|     WINDOWS      |      MACOS       |      LINUX       |
+------------------+------------------+------------------+
|                  |                  |                  |
|  Microsoft Edge  |    WKWebView     |    webkitgtk     |
|    WebView2      |                  |                  |
|                  |                  |                  |
|  Chromium-based  |  Safari engine   |  WebKit engine   |
|                  |                  |                  |
+------------------+------------------+------------------+
         |                  |                  |
         +------------------+------------------+
                           |
                    Dynamic Linking
                    (Not bundled)
                           |
                    Smaller executables

Key Characteristics

  1. Dynamic Linking: WebView libraries are linked at runtime, not bundled
  2. Web Technologies: Execute HTML, CSS, and JavaScript
  3. Framework Support: Works with React, Vue, Svelte, Solid, etc.
  4. Isolation: Each WebView runs in its own process space

Process Communication (IPC)

All communication between processes flows through the Core process.

+----------------+                              +----------------+
|   WebView A    |                              |   WebView B    |
|                |                              |                |
|  invoke()  ----+---->+----------------+<------+---- invoke()   |
|                |     |  CORE PROCESS  |       |                |
|  <---- listen  |<----+                +------>|  listen ---->  |
|                |     |  - Validates   |       |                |
+----------------+     |  - Routes      |       +----------------+
                       |  - Filters     |
                       |  - Transforms  |
                       +----------------+
                              |
                              v
                       +----------------+
                       |   OS / System  |
                       |   Resources    |
                       +----------------+

IPC Flow

  1. WebView calls invoke() with a command name and payload
  2. Core process receives the message
  3. Core process validates and processes the request
  4. Core process may interact with OS resources
  5. Core process sends response back to WebView

Example: Basic IPC

Frontend (JavaScript)

import { invoke } from '@tauri-apps/api/core';

// Call a Rust command
const result = await invoke('greet', { name: 'World' });

Backend (Rust)

#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

Multiwindow Handling

A single Core process manages multiple WebView processes.

                    +-------------------+
                    |   CORE PROCESS    |
                    |                   |
                    |  Shared State:    |
                    |  - User session   |
                    |  - App config     |
                    |  - DB connection  |
                    +-------------------+
                           /|\
                          / | \
                         /  |  \
                        /   |   \
                       /    |    \
                      v     v     v
               +------+ +------+ +------+
               |Main  | |Settings| |About|
               |Window| |Window | |Window|
               +------+ +------+ +------+

Window Management Patterns

Creating Windows

use tauri::Manager;

#[tauri::command]
fn open_settings(app: tauri::AppHandle) {
    tauri::WebviewWindowBuilder::new(
        &app,
        "settings",
        tauri::WebviewUrl::App("settings.html".into())
    )
    .title("Settings")
    .build()
    .unwrap();
}

Cross-Window Communication

use tauri::Manager;

#[tauri::command]
fn broadcast_update(app: tauri::AppHandle, data: String) {
    // Emit to all windows
    app.emit("data-updated", data).unwrap();
}

Window-Specific Events

use tauri::Manager;

#[tauri::command]
fn notify_window(app: tauri::AppHandle, window_label: String, data: String) {
    if let Some(window) = app.get_webview_window(&window_label) {
        window.emit("notification", data).unwrap();
    }
}

Process Isolation and Security

The Principle of Least Privilege

"If you have a gardener coming over to trim your hedge, you give them the key to your garden. You would not give them the keys to your house."
+------------------------------------------------------------------+
|                     SECURITY BOUNDARIES                           |
+------------------------------------------------------------------+
|                                                                   |
|  +---------------------------+   +---------------------------+    |
|  |      CORE PROCESS         |   |     WEBVIEW PROCESS       |    |
|  |      (Trusted Zone)       |   |    (Untrusted Zone)       |    |
|  +---------------------------+   +---------------------------+    |
|  |                           |   |                           |    |
|  |  - File system access     |   |  - Render UI only         |    |
|  |  - Database connections   |   |  - User input handling    |    |
|  |  - Network requests       |   |  - Display data           |    |
|  |  - Crypto operations      |   |  - Call allowed commands  |    |
|  |  - Secrets management     |   |                           |    |
|  |  - Business logic         |   |  NO DIRECT ACCESS TO:     |    |
|  |                           |   |  - File system            |    |
|  |                           |   |  - Network (direct)       |    |
|  |                           |   |  - System APIs            |    |
|  +---------------------------+   +---------------------------+    |
|                                                                   |
+------------------------------------------------------------------+

Security Benefits of Process Isolation

BenefitDescription
Crash ContainmentFailures in one process don't crash the entire app
State RecoveryInvalid processes can be restarted independently
Attack Surface ReductionCompromised WebView has limited capabilities
Resource ProtectionSensitive data stays in Core process

Security Best Practices

In the Frontend (WebView)

  1. Sanitize all user input
  2. Never handle secrets
  3. Defer business logic to Core process
  4. Implement Content Security Policy (CSP)

In the Backend (Core Process)

  1. Validate all IPC inputs
  2. Use the capability system to restrict commands
  3. Apply principle of least privilege to each window

Capability-Based Security

Tauri uses a capability system to control what each window can access.

+------------------+     +------------------+     +------------------+
|   Main Window    |     | Settings Window  |     |  Viewer Window   |
+------------------+     +------------------+     +------------------+
| Capabilities:    |     | Capabilities:    |     | Capabilities:    |
| - read_file      |     | - read_config    |     | - read_file      |
| - write_file     |     | - write_config   |     | (read only)      |
| - network        |     |                  |     |                  |
| - notifications  |     |                  |     |                  |
+------------------+     +------------------+     +------------------+

Example: Capability Configuration

{
  "identifier": "main-capability",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": [
    "core:default",
    "fs:read-files",
    "fs:write-files",
    "http:default"
  ]
}

Process Lifecycle

+------------------------------------------------------------------+
|                      APPLICATION LIFECYCLE                        |
+------------------------------------------------------------------+
|                                                                   |
|  1. App Launch                                                    |
|     +------------------+                                          |
|     | Core Process     |  <-- Starts first                        |
|     | Initializes      |                                          |
|     +------------------+                                          |
|              |                                                    |
|              v                                                    |
|  2. Window Creation                                               |
|     +------------------+                                          |
|     | WebView Process  |  <-- Core creates WebViews               |
|     | Spawned          |                                          |
|     +------------------+                                          |
|              |                                                    |
|              v                                                    |
|  3. Running                                                       |
|     +--------+    IPC    +----------+                             |
|     | Core   |<--------->| WebViews |                             |
|     +--------+           +----------+                             |
|              |                                                    |
|              v                                                    |
|  4. Shutdown                                                      |
|     +------------------+                                          |
|     | WebViews close   |  <-- WebViews terminate first            |
|     | Core cleans up   |  <-- Core process exits last             |
|     +------------------+                                          |
|                                                                   |
+------------------------------------------------------------------+

Summary

AspectCore ProcessWebView Process
LanguageRustJavaScript/TypeScript
QuantityOne per appOne or more per app
OS AccessFullNone (via IPC only)
RoleBackend, orchestrationUI rendering
SecurityTrustedUntrusted
Crash ImpactApp terminatesWindow closes

The Tauri process model provides a secure foundation for building desktop applications by maintaining strict separation between the trusted Core process and the potentially vulnerable WebView processes. All sensitive operations should be implemented in the Core process, with the WebView serving only as a presentation layer.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

30.76%
按下载量换算162

OpenCode

21.51%
按下载量换算113

Antigravity

18.04%
按下载量换算95

windsurf

12.28%
按下载量换算65

Gemini CLI

7.18%
按下载量换算38

Codex

3.2%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills