Skip to content

Grant the packaged UI its folder picker, terminal replay and Tailscale opener - #6525

Merged
BunsDev merged 1 commit into
mainfrom
fix/issue-6502-loopback-grants
Nov 20, 2026
Merged

BunsDev merged 1 commit into
mainfrom
fix/issue-6502-loopback-grants

Conversation

@BunsDev

@BunsDev BunsDev commented Nov 20, 2026

Copy link
Copy Markdown
Member

Refs #6502

What changes

The packaged main UI runs on the sidecar's loopback origin (http://127.0.0.1:3020), where Tauri refused four commands that worked only in dev. Per Val's decision (grant all four, narrowly):

Command Change
shell_pick_directory New exact capability loopback-folder-picker (main webview, loopback origins, one permission)
open_tailscale_app New exact capability loopback-tailscale-app. The command takes no arguments, and the launcher uses fixed ones
pty_snapshot allow-pty-snapshot, added to loopback-browser beside the existing PTY grants. It still checks ensure_trusted_pty_caller and reads only the caller's own sessions
shell_open_path Not granted. Its two callers (the home-migration backup folder and Settings › Workspace path) now use the already-granted shell_reveal_path

Why shell_open_path isn't granted: it opens any existing directory, and on macOS open launches an .app or document bundle, which is a directory on disk. shell_reveal_path opens a plain folder the same way, but selects a bundle in its parent instead of launching it. Moving the callers is narrower than the "limited to Cave-owned paths" grant Val approved, and it adds no new loopback authority. One visible difference: a workspace folder whose name has an extension (for example site.v2) is now selected in its parent instead of opened.

The quick-chat tray gets none of these grants. The four #6502 rows are removed from the known-gap list in src-tauri/permissions/desktop-permissions.test.mjs.

Evidence

  • node --test src-tauri/permissions/desktop-permissions.test.mjs: 25/25. That includes two new tests (each grant's exact scope, no grant on remote origins or in the tray, no loopback shell_open_path grant or caller) and the existing invoke-sweep contract with an empty Packaged main UI invokes app commands its loopback origin is not granted (folder picker, open path, PTY snapshot, Tailscale) #6502 gap list.
  • Mutation check: adding an extra permission to loopback-folder-picker fails the suite.
  • cargo check passes (tauri-build validates the capability files). pnpm typecheck and eslint on the changed files pass. The callers' component tests are repinned to shell_reveal_path, and all 34 related component tests pass (run like CI).

Not verified here

Packaged proof needs an installed build that contains this change. The drill used for #6503 applies: an argument-less invoke is denied before and admitted after (see #6502's table), the picker opens from First project, and the bottom terminal replays after a remount. Windows rows need the Windows guest.

…e opener

The packaged main UI is served from the sidecar's loopback origin, where
Tauri refused four app commands it calls: the folder picker, opening a folder,
the terminal's scrollback replay and opening the Tailscale app (#6502).

- shell_pick_directory and open_tailscale_app get their own exact loopback
  capabilities for the main webview. pty_snapshot joins the terminal grants in
  loopback-browser and still reads only the caller's own sessions.
- The two open-folder callers (backup folder, workspace folder) now use the
  already-granted shell_reveal_path, which opens a plain folder but selects an
  app or document bundle instead of launching it. shell_open_path stays
  local-only.
- The contract test's #6502 known-gap rows are removed, with tests for each
  grant's exact scope.

Refs #6502
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant