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
This commit is contained in:
程序员阿江(Relakkes) 2026-05-13 12:30:15 +08:00
parent 08747bfdd2
commit a54e97d532
2 changed files with 32 additions and 0 deletions

View File

@ -100,6 +100,7 @@
},
"dialog:allow-open",
"dialog:allow-save",
"dialog:allow-message",
"notification:default",
"process:allow-exit",
"process:allow-restart",

View File

@ -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')
})
})