tauri-standards
Tauri shell standards — the IPC 5-step capability flow, command implementation pattern, and capability/permission wiring. Load for new IPC capabilities and changes to commands.rs / tauri-client.ts / capabilities/.
saeedkolivand · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add saeedkolivand/ai-job-hunter-app --skill tauri-standards技能说明
name: tauri-standards description: Tauri shell standards — the IPC 5-step capability flow, command implementation pattern, and capability/permission wiring. Load for new IPC capabilities and changes to commands.rs / tauri-client.ts / capabilities/.
Tauri / IPC standards
New IPC capability — 5 files, in order
packages/shared/src/ipc/contracts/— add the typed signature (Zod schema) in a new/existing contract file.apps/desktop/src-tauri/src/commands/— implement the Tauri command (typedAppResult, noResult<_,String>).apps/desktop/src/tauri-client/index.ts— wire theinvokecall.apps/desktop/src/renderer/services/— add the React Query service hook (nowindow.apiin UI).services/query-client.ts— add the query key.
Missing any step = an incomplete capability (HIGH). The contract in packages/shared is the single source of truth.
Capabilities & permissions
- New commands must be allowed in
capabilities/default.json— an exposed-but-unlisted command, or an over-broad capability, is a security finding (defer the security lens totauri-security-reviewer). - Principle of least privilege for filesystem/shell/network scopes.
Renderer ↔ shell
Renderer talks to the shell only via the AppClient context (createTauriInvokeClient() in apps/desktop/src/tauri-client/index.ts). No direct invoke in features/routes/components.
Boundaries
packages/shared— no React, no Node APIs.packages/ui— no Zustand, no IPC, no routing.packages/prompts— no UI, nowindow.
External standards & best-practices (verified 2026-06-19)
Latest stable Tauri 2.10.x. v2 model = permissions (per-command) + scopes (arg validators) + capabilities (bind sets to windows); no command is exposed by default. https://v2.tauri.app/security/
- Least-privilege capabilities — grant only what each window needs in
capabilities/*.json; scope to specificwindows/webviews; preferallow-scopes; never ship*-stylefs/shell/http. https://v2.tauri.app/security/capabilities/ - CSP — strict
app.security.cspintauri.conf.json; nounsafe-inline/unsafe-eval(Tauri hashes/nonces local assets). https://v2.tauri.app/security/csp/ - IPC surface — treat every
#[tauri::command]as an untrusted entry point; validate/sanitize args in Rust; keep the command set minimal; gate sensitive commands behind their own narrow capability. - Isolation pattern —
app.security.pattern = "isolation"to verify IPC in a sandboxed iframe whenever the frontend renders any remote/untrusted content. https://v2.tauri.app/concept/inter-process-communication/isolation/ - Updater signing (mandatory) — minisign-sign every release; ship the public key in
plugins.updater.pubkey; private key + password offline (CI secret only); HTTPS manifests. https://v2.tauri.app/plugin/updater/ - Dep hygiene —
cargo auditclean (e.g. RUSTSEC-2026-0098rustls-webpkican reach the updater/HTTP TLS stack); minimize plugins; track https://github.com/tauri-apps/tauri/security/advisories
Common mistakes: over-broad capabilities (one capability → every plugin permission → every window); leaving shell/fs/withGlobalTauri open in prod; weak/default CSP (unsafe-inline); trusting command args without Rust-side validation; committing the updater private key or disabling signature verification; skipping cargo audit so a transitive advisory ships silently.