This document deepens the Tauri 2.x permission and trust-boundary design for Agentic Hub. Start with ARCHITECTURE.md for the full system view.
The root architecture establishes two trust zones: the untrusted WebView (React UI) and the trusted Rust core (agentic-core). Tauri 2.x's capability system is the mechanism that enforces this boundary at the IPC layer. This doc owns the capability model, FS scope rules, and platform-specific filesystem constraints (notably Windows symlinks).
Tauri 2.x's permission model is meaningfully different from Tauri 1.x's allowlist. It uses fine-grained capability JSON files that scope which commands and which paths a given window can access. For an app that writes into multiple sensitive tool homes (~/.codex, ~/.claude, ~/.cursor, ~/.openclaw) and accepts user-picked workspace dirs at runtime, the capability story is itself a substantial design surface. Folding it into the root architecture would either bloat the root doc or under-specify a critical safety surface.
This doc also owns the cross-platform symlink story because symlink semantics interact directly with the FS scope model and dictate which platforms can ship which features in v1.
- Define the static capability surface declared in
src-tauri/capabilities/*.json - Define how user-picked workspace directories add runtime scope
- Define what the WebView cannot do (negative capabilities)
- Document the Windows symlink constraint and the managed-copy fallback path
- Provide a checklist for reviewing capability files before each release
- Auto-update signing (deferred to launch)
- Code signing for macOS Gatekeeper (deferred to launch)
- Sandboxing the Rust core (out of scope; Rust core is fully trusted)
- Cross-app sandboxing (e.g. restricting what Codex itself can read from
~/.agents/skills) — Agentic Hub does not enforce what the target tools do with the projected files
In scope:
- Tauri capability files (
src-tauri/capabilities/) - Allowed Tauri plugins and their scope (fs, dialog, store, updater)
- Disabled plugins (shell)
- Path validation rules inside the Rust core
- Windows symlink behavior and fallback
Out of scope:
- The IPC payload schema itself (see docs/tech/modules/tauri-ipc-contract.md)
- The plan/apply business logic (see ARCHITECTURE.projection.md)
Tauri 2.x ships with these plugins relevant to this app:
tauri-plugin-fs— scoped FS access from the WebView (we use it minimally; almost all FS work happens inagentic-core)tauri-plugin-dialog— native folder picker (needed for workspace selection)tauri-plugin-store— persistent key-value store (used forstate.jsonworkspace target LRU)tauri-plugin-shell— explicitly disabled (the WebView must never run arbitrary commands)tauri-plugin-opener— opens files in an app and reveals them in the file explorer; the scoped, official successor toshell'sopenAPI. Initialized, but called only from Rust commands (cmd_open_path/cmd_reveal_path) with a server-side path allowlist — the WebView gets no opener scope.tauri-plugin-updater— deferred to post-v1
The Rust core uses std::fs, std::os::unix::fs::symlink (Unix), std::os::windows::fs::{symlink_file, symlink_dir} (Windows), and fs_extra for recursive copy.
+--------------------+ +-----------------------+
| WebView (UI) | IPC only | Rust core |
| - React | <----------> | - all FS mutations |
| - never touches | | - all path validate |
| filesystem | | - all symlink ops |
| - typed invoke() | | - tool home writes |
+--------------------+ +-----------------------+
^ ^
| |
capability JSON OS file permissions
(allowlist of (root for nothing;
invokable cmds) user-level access)
The WebView never holds a filesystem handle. Every command parameter is validated server-side. A compromised WebView (e.g. via a malicious skill file rendered in the inspector) cannot escalate to FS writes outside the scoped paths, and cannot run shell commands at all.
Tauri 2.x reads capability JSON files from src-tauri/capabilities/. Each capability declares: which windows it applies to, which IPC commands are permitted, and (for FS / dialog) which paths are scoped.
Permitted:
- Custom commands defined in
agentic-hubbin crate (the fullcmd_*surface — see docs/tech/modules/tauri-ipc-contract.md) core:event:default— listen to events emitted from Rustcore:window:default— basic window controls (close, minimize, drag)dialog:default,dialog:allow-open— folder pickerstore:default— KV store access forstate.json
Denied / not granted:
shell:*— neverfs:*direct from the WebView — instead, all FS work goes through our custom commands which enforce path validation internallyos:*beyondcore:os:default— no env-var reads from the WebView
When the user picks a workspace directory via the dialog plugin, the Rust core stores that directory and exposes read-only commands scoped to it. The capability file does not statically grant access to ~/Code/**. Workspace scope is read-only — cmd_scan_workspace only reads a project's own tool dirs and writes nothing — so there is no write-side boundary to enforce there. The scan resolves the target dir from the workspace target store and walks only the known per-tool subpaths under it.
The palette and install windows are separate Tauri windows, so they need
their own capability files (a capability applies only to the windows it lists).
Each grants core:default plus the window controls it uses — show / hide /
set-focus (and, for install, close + start-dragging) — and core:event so the
window can listen for (and the palette can emit) cross-window events. Neither
grants dialog, store, or fs. The custom cmd_* surface is cross-window and
needs no plugin permission, so the streaming install commands
(cmd_install_skill_stream et al.) work without being listed. The skill install
itself still runs only in the Rust core via a fixed, validated std::process::Command
argv — there is no tauri-plugin-shell.
Tool homes are predictable. They live under the user's home directory at well-known paths. The agentic-core::adapter_registry resolves these at runtime via dirs::home_dir(). The capability layer does not statically restrict tool-home access because the user may configure non-default skillsPath / agentsPath / etc. — and we want those to work.
The safety net: every write inside applier and rule_sync resolves the target to an absolute canonical path, refuses to overwrite real files / dirs, and refuses to write outside the tool's configured target paths. The Rust core enforces this; the capability file does not.
Configured minimally. The WebView is not granted fs:allow-read or fs:allow-write against any path by default. The only FS-adjacent capability the WebView holds is the dialog plugin, which returns a path string the user explicitly chose.
If a future feature needs WebView-side FS read (e.g. showing a rule body preview in a <pre> block), the preferred approach is to add a cmd_read_capability_body(item_id) command in agentic-core rather than granting the WebView raw fs:allow-read.
Granted dialog:allow-open for folder selection. Used by the workspace target picker.
Granted store:default access scoped to state.json under the app data directory (~/.agentic-hub/state.json on macOS/Linux, %APPDATA%/agentic-hub/state.json on Windows). Used for the workspace target LRU and last-active tool tab.
Not added to Cargo.toml. Not declared in capability files. The WebView cannot spawn processes.
Added to Cargo.toml and initialized in the shell. It is not declared in any capability file, so the WebView cannot call it directly. Instead, cmd_open_path / cmd_reveal_path validate the path with agentic_core::open_targets::is_openable (must canonicalize under a configured source root, a tool target path, or a known workspace dir) and then call the plugin's Rust API. This is the scoped, modern replacement for shell's deprecated open and keeps the shell plugin out of the dependency tree.
Will be added in a post-v1 release once a signed manifest endpoint exists. Until then, users update by downloading a new .dmg / .deb.
Every command that accepts a path parameter validates it before any FS op. The rules are:
- Tilde expansion.
~/fooresolves to the user's home directory at the start of validation, never inside FS ops. Mixed-case~handling is OS-specific; we always expand viadirs::home_dir(). - Canonicalization.
path.canonicalize()is called once, early. Symlinks in the path are resolved. Errors here propagate aspath_not_foundorpath_invalid. - No path traversal.
..segments are not stripped; canonicalization handles them. After canonicalization,starts_withchecks compare against the canonicalized parent. - Tool-home scope. Apply ops verify the resolved target lives under one of
{skills,agents,rules,instructions}_pathfor the focused tool. Writes outside this scope are refused. - Workspace scope. Workspace patch ops verify the resolved target lives under
realpath(workspace_dir). See above. - Real-file guard. Before any
replace_link/replace_managed_copy/remove_linkop, the target islstat-checked. A regular file or directory blocks the op (skip_conflict).
On Windows, creating symlinks requires either:
- Developer Mode enabled in Windows Settings, or
- The user running the app as administrator, or
- The user holding
SeCreateSymbolicLinkPrivilege
None of these are reliable assumptions for a personal-tool app. For v1, the design rules are:
- macOS and Linux are primary. Symlinks work via
std::os::unix::fs::symlink. - Windows is documented as constrained. v1 does not officially ship Windows binaries.
- Managed-copy fallback path. The
appliercode paths that use managed copies (Cursor agents in global scope) work on Windows in principle. A future Windows release can opt every tool into managed-copy projection by settingruleProjectionKind = file_syncfor tools that currently uselink_sync, and overriding thelink_syncagent path to usecreate_managed_copy. This is a config-only change to the adapter layer. - Stale detection still works. Managed-copy sync metadata stores the source path + content hash; refresh-on-source-change works identically on Windows.
If we ship Windows in a later release, the symlink path must be guarded:
fn create_symlink(source: &Path, target: &Path) -> Result<()> { #[cfg(unix)] { std::os::unix::fs::symlink(source, target).map_err(Error::from) } #[cfg(windows)] { let attempted = if source.is_dir() { std::os::windows::fs::symlink_dir(source, target) } else { std::os::windows::fs::symlink_file(source, target) }; attempted.or_else(|_| fall_back_to_managed_copy(source, target)) } }
This is documented for future work, not implemented in v1.
The WebView cannot:
- Run shell commands (
tauri-plugin-shellnot loaded) - Read or write arbitrary files (no
fs:allow-*granted) - Read environment variables beyond what Tauri exposes by default
- Spawn child windows except via documented commands
- Open files or external URLs directly (no opener scope granted to the WebView). Opening a file in the user's editor goes through the dedicated
cmd_open_path/cmd_reveal_pathcommands, which validate the path againstagentic_core::open_targets::is_openablebefore callingtauri-plugin-openerfrom Rust - Bypass the per-command argument validation in the Rust core
- Every release: review every capability file and confirm no
*:allow-*was added without an explicit security rationale in the commit message - Every new IPC command: review its payload validation in
agentic-corebefore merge - Every new path parameter: confirm it goes through the validator before any FS op
tauri-plugin-shellmust remain absent fromCargo.toml. If a future feature seems to need it, raise that as a security design discussion, not a quiet dependency addition
- docs/tech/modules/tauri-ipc-contract.md — full command surface and event schemas
- docs/tech/modules/workspace-inventory.md — read-only workspace scan contract
| Component | Failure | Impact | Recovery |
|---|---|---|---|
| Capability denial | UI invokes a command not in its capability file | Tauri rejects the IPC call | Bubble error to UI as permission_denied; user reports as a bug |
| Path canonicalization | Target path does not exist | Validator returns path_not_found |
Surface in UI; user creates parent or fixes settings |
| Workspace scan error | A workspace tool dir is unreadable | workspace_inventory::scan_workspace records a ScanError for that dir |
Continue scanning remaining dirs; report errors in WorkspaceInventory.errors |
| Tool-home scope violation | Apply tries to write outside configured tool paths | applier refuses |
Surface as bug (this should never happen if adapters are correct) |
| Windows symlink fail (future) | symlink_file returns ERROR_PRIVILEGE_NOT_HELD |
Fall back to managed copy if implemented; otherwise error | Document Developer Mode requirement in install docs |
| Plugin store write fail | Disk full / permission | LRU state lost | Surface; in-memory state preserved until next app start |
Should we ship aResolved (2026-06-01). Shipped ascmd_open_in_editor(path)that usestauri-plugin-shell::opento open a file in the user's default editor?cmd_open_path/cmd_reveal_pathusingtauri-plugin-opener(notshell), gated by a path allowlist (open_targets::is_openable) instead of an extension allowlist. The preferred editor is configurable in settings. See docs/features/open-files.md.- Should we add
tauri-plugin-fswith afs:scopeof~/.agentic/**(read-only) so a future "preview rule body" feature can render markdown without a custom command? Decision: no in v1. Custom command keeps the boundary clean. - macOS notarization: required for distributing the
.dmgwithout Gatekeeper warnings. Decide at M4 whether to invest in an Apple Developer account for this personal-tool app, or document the right-click-open workaround in install docs.