fix(ipc): declare the app commands and grant them to the app origin (Tauri 2.11+ ACL)

With Tauri 2.12 every app command was refused ("Command … not allowed by
ACL"): the app is served from http://localhost:44548 (tauri-plugin-
localhost), which Tauri treats as a remote origin, and since the
GHSA-7gmj-67g7-phm9 fix app commands need an explicit capability. The
Windows smoke test caught it (keychain, hotkeys, tray/taskbar/thumbbar,
token migration all failed).

build.rs now declares the 35 commands as an app manifest, and
capabilities/migrated.json (scoped to http://localhost:44548 only) grants
allow-<command> for each. The call page (http://127.0.0.1:44548) and any
remote frame still get no IPC. gen/schemas regenerated by tauri-build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
This commit is contained in:
Lotus CI
2026-10-26 01:59:33 -04:00
co-authored by Claude Opus 5.5
parent e3bc4e128f
commit 7fecf72107
6 changed files with 1334 additions and 8482 deletions
+46 -1
View File
@@ -1,3 +1,48 @@
fn main() {
tauri_build::build()
// Tauri 2.11+ only lets a page call app commands that a capability allows
// (GHSA-7gmj-67g7-phm9). Declaring them here generates an `allow-<name>`
// permission for each; capabilities/migrated.json grants them to the app's
// own origin (http://localhost:44548) and nothing else, so the call page
// (http://127.0.0.1:44548) and remote frames still get no IPC.
// Keep this list in sync with `generate_handler!` in src/lib.rs.
tauri_build::try_build(tauri_build::Attributes::new().app_manifest(
tauri_build::AppManifest::new().commands(&[
"check_for_update",
"flash_window",
"focus_main_window",
"get_close_behavior",
"get_focus_assist",
"get_start_minimized",
"get_tray_dnd",
"global_hotkeys_supported",
"has_tray_host",
"install_update",
"resolve_close_request",
"secure_session_clear",
"secure_session_get",
"secure_session_set",
"secure_session_supported",
"send_notification",
"set_badge_count",
"set_call_active",
"set_close_behavior",
"set_custom_chrome",
"set_global_hotkeys",
"set_jump_list",
"set_smtc_call_state",
"set_start_minimized",
"set_taskbar_progress",
"set_thumbbar",
"set_tray_call_state",
"set_tray_unread",
"set_tray_update_ready",
"show_rich_toast",
"update_install_kind",
"window_close",
"window_minimize",
"window_start_drag",
"window_toggle_maximize",
]),
))
.expect("failed to run tauri-build");
}
+43 -1
View File
@@ -53,7 +53,49 @@
"autostart:allow-is-enabled",
{
"identifier": "opener:allow-open-url",
"allow": [{ "url": "http://*" }, { "url": "https://*" }]
"allow": [
{
"url": "http://*"
},
{
"url": "https://*"
}
]
},
"allow-check-for-update",
"allow-flash-window",
"allow-focus-main-window",
"allow-get-close-behavior",
"allow-get-focus-assist",
"allow-get-start-minimized",
"allow-get-tray-dnd",
"allow-global-hotkeys-supported",
"allow-has-tray-host",
"allow-install-update",
"allow-resolve-close-request",
"allow-secure-session-clear",
"allow-secure-session-get",
"allow-secure-session-set",
"allow-secure-session-supported",
"allow-send-notification",
"allow-set-badge-count",
"allow-set-call-active",
"allow-set-close-behavior",
"allow-set-custom-chrome",
"allow-set-global-hotkeys",
"allow-set-jump-list",
"allow-set-smtc-call-state",
"allow-set-start-minimized",
"allow-set-taskbar-progress",
"allow-set-thumbbar",
"allow-set-tray-call-state",
"allow-set-tray-unread",
"allow-set-tray-update-ready",
"allow-show-rich-toast",
"allow-update-install-kind",
"allow-window-close",
"allow-window-minimize",
"allow-window-start-drag",
"allow-window-toggle-maximize"
]
}
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["updater:default","global-shortcut:default"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","clipboard-manager:default",{"identifier":"opener:allow-open-url","allow":[{"url":"http://*"},{"url":"https://*"}]}]}}
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["updater:default","deep-link:default"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","remote":{"urls":["http://localhost:44548"]},"local":true,"windows":["main"],"permissions":["core:default","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","notification:default","core:app:allow-app-show","core:app:allow-app-hide","autostart:allow-enable","autostart:allow-disable","autostart:allow-is-enabled",{"identifier":"opener:allow-open-url","allow":[{"url":"http://*"},{"url":"https://*"}]},"allow-check-for-update","allow-flash-window","allow-focus-main-window","allow-get-close-behavior","allow-get-focus-assist","allow-get-start-minimized","allow-get-tray-dnd","allow-global-hotkeys-supported","allow-has-tray-host","allow-install-update","allow-resolve-close-request","allow-secure-session-clear","allow-secure-session-get","allow-secure-session-set","allow-secure-session-supported","allow-send-notification","allow-set-badge-count","allow-set-call-active","allow-set-close-behavior","allow-set-custom-chrome","allow-set-global-hotkeys","allow-set-jump-list","allow-set-smtc-call-state","allow-set-start-minimized","allow-set-taskbar-progress","allow-set-thumbbar","allow-set-tray-call-state","allow-set-tray-unread","allow-set-tray-update-ready","allow-show-rich-toast","allow-update-install-kind","allow-window-close","allow-window-minimize","allow-window-start-drag","allow-window-toggle-maximize"]}}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff