From 625fd98368f5d57455d8d2bc9ccfa5f35c0eb5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Wed, 27 May 2026 22:12:51 +0800 Subject: [PATCH] fix: unblock desktop confirm dialogs (#512) Tauri's desktop webview injects window.confirm through the dialog confirm command, but the default desktop capability only allowed the message dialog command. Windows release builds could therefore reject confirm at ACL time even though the browser-facing code path looked valid in local web development. Constraint: Tauri plugin-dialog 2.7 still exposes window.confirm as plugin:dialog|confirm in the injected webview shim. Rejected: Grant dialog:default | broader than the specific confirm compatibility gap. Confidence: high Scope-risk: narrow Directive: Keep confirm permission covered while the desktop webview exposes browser confirm shims. Tested: cd desktop && bun run test -- --run src/__tests__/tauriCapabilities.test.ts Tested: bun run check:desktop Tested: bun run check:native Not-tested: Windows release package manual smoke --- desktop/src-tauri/capabilities/default.json | 1 + desktop/src/__tests__/tauriCapabilities.test.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/desktop/src-tauri/capabilities/default.json b/desktop/src-tauri/capabilities/default.json index 758ad77c..47feb588 100644 --- a/desktop/src-tauri/capabilities/default.json +++ b/desktop/src-tauri/capabilities/default.json @@ -101,6 +101,7 @@ "dialog:allow-open", "dialog:allow-save", "dialog:allow-message", + "dialog:allow-confirm", "notification:default", "process:allow-exit", "process:allow-restart", diff --git a/desktop/src/__tests__/tauriCapabilities.test.ts b/desktop/src/__tests__/tauriCapabilities.test.ts index 68e6bf65..ed4daa67 100644 --- a/desktop/src/__tests__/tauriCapabilities.test.ts +++ b/desktop/src/__tests__/tauriCapabilities.test.ts @@ -22,6 +22,16 @@ describe('Tauri default capability', () => { ).toBe(true) }) + it('allows the browser confirm shim used by the desktop webview', () => { + const permissions = readDefaultCapabilityPermissions() + + expect( + permissions.some(permission => + permission === 'dialog:default' || permission === 'dialog:allow-confirm' + ) + ).toBe(true) + }) + it('keeps file dialog access enabled', () => { const permissions = readDefaultCapabilityPermissions()