From a54e97d532958adac6176eace7bac2fc735d20c0 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, 13 May 2026 12:30:15 +0800 Subject: [PATCH] Allow desktop confirm dialogs to reach Tauri Superpowers can trigger plan approval or browser confirm flows inside the desktop shell. Tauri's dialog plugin shims window.confirm through the message command, but the desktop capability only allowed file open/save dialogs, so Windows rejected confirm with an ACL error and left the flow blocked. Constraint: Tauri plugin-dialog 2.7 routes alert/confirm through the message permission. Rejected: Grant dialog:default | broader than needed for this bugfix. Confidence: high Scope-risk: narrow Directive: Keep dialog message permission whenever browser confirm or alert shims are available in desktop. Tested: cd desktop && bun run test -- --run src/__tests__/tauriCapabilities.test.ts Tested: bun run check:native Tested: bun run check:desktop --- desktop/src-tauri/capabilities/default.json | 1 + .../src/__tests__/tauriCapabilities.test.ts | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 desktop/src/__tests__/tauriCapabilities.test.ts diff --git a/desktop/src-tauri/capabilities/default.json b/desktop/src-tauri/capabilities/default.json index 02123d46..758ad77c 100644 --- a/desktop/src-tauri/capabilities/default.json +++ b/desktop/src-tauri/capabilities/default.json @@ -100,6 +100,7 @@ }, "dialog:allow-open", "dialog:allow-save", + "dialog:allow-message", "notification:default", "process:allow-exit", "process:allow-restart", diff --git a/desktop/src/__tests__/tauriCapabilities.test.ts b/desktop/src/__tests__/tauriCapabilities.test.ts new file mode 100644 index 00000000..68e6bf65 --- /dev/null +++ b/desktop/src/__tests__/tauriCapabilities.test.ts @@ -0,0 +1,31 @@ +import { describe, expect, it } from 'vitest' +import defaultCapabilityJson from '../../src-tauri/capabilities/default.json?raw' + +function readDefaultCapabilityPermissions(): string[] { + const capability = JSON.parse(defaultCapabilityJson) as { + permissions?: unknown[] + } + + return (capability.permissions ?? []).filter((permission): permission is string => + typeof permission === 'string' + ) +} + +describe('Tauri default capability', () => { + it('allows the dialog message API used by Tauri alert/confirm shims', () => { + const permissions = readDefaultCapabilityPermissions() + + expect( + permissions.some(permission => + permission === 'dialog:default' || permission === 'dialog:allow-message' + ) + ).toBe(true) + }) + + it('keeps file dialog access enabled', () => { + const permissions = readDefaultCapabilityPermissions() + + expect(permissions).toContain('dialog:allow-open') + expect(permissions).toContain('dialog:allow-save') + }) +})