Skip to content

Require a policy-set authorisation key before showing a dialog - #18

Merged
rodchristiansen merged 1 commit into
mainfrom
feature/authorisation-key
Oct 9, 2026
Merged

rodchristiansen merged 1 commit into
mainfrom
feature/authorisation-key

Conversation

@rodchristiansen

Copy link
Copy Markdown
Contributor

Closes #17.

  • DialogAuthorisation (Core): reads AuthorisationKey from HKLM\SOFTWARE\Policies\csharpDialog only (64-bit view), hashes the caller's key (SHA-256, hex, trimmed, constant-time compare, case-insensitive), env DIALOG_AUTH_KEY first then --key/--key=. Refusal: "Key authorisation required" to stderr + log, exit 30, no window.
  • Enforced first thing in both entry points: dialog.exe (CLI, covers command-file, JSON, fullscreen/kiosk, --autolaunch) and the WPF host. --key is removed from the args before they are logged or parsed.
  • A value under HKCU or HKLM\SOFTWARE\csharpDialog[\Settings] is ignored and logged.
  • Managed Notifications Dialog: Prefs shows an Authorisation key card with a Managed badge when policy sets it; Run shows a password box when required and passes it through the environment.
  • README documents the policy value, the hash snippet and how callers pass the key.
  • Tests: no policy → runs; right key via env and via --key → runs, --key stripped; case-insensitive hash; env wins; missing/wrong → 30; HKCU value does not enable enforcement. 49/49 pass.

When HKLM\SOFTWARE\Policies\csharpDialog\AuthorisationKey holds the hex SHA-256
of a key, dialog.exe and the WPF host show a window only to a caller that passes
that key in DIALOG_AUTH_KEY or with --key. Anything else writes "Key authorisation
required" to stderr and the log and exits 30, matching swiftDialog. The value is
read from policy only; one under HKCU or the tool's own key is ignored and logged.
--key is stripped before the arguments are logged.

Managed Notifications Dialog marks the key Managed on Prefs, and the Run tab takes
a key and passes it through the environment, never the command line.

Closes #17
@rodchristiansen
rodchristiansen merged commit fcfd89b into main Oct 9, 2026
1 check passed
@rodchristiansen
rodchristiansen deleted the feature/authorisation-key branch October 9, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Require an authorisation key before showing a dialog (swiftDialog AuthorisationKey parity)

1 participant