Skip to content

Lock down ProgramData\ManagedNotifications, and report dialog results in local time - #11

Merged
rodchristiansen merged 1 commit into
mainfrom
fix/notifications-acl-local-time
Oct 7, 2026
Merged

rodchristiansen merged 1 commit into
mainfrom
fix/notifications-acl-local-time

Conversation

@rodchristiansen

Copy link
Copy Markdown
Contributor

What

  1. Data folder ACL. %ProgramData%\ManagedNotifications kept ProgramData's inherited ACL, so Users could create and write files there. It now gets its own:
    • Root: owner SYSTEM; SYSTEM and Administrators full control; Users read and execute; inheritance off (O:SYG:SYD:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;BU)).
    • logs only: the same plus Users modify (0x1301bf). dialog.exe runs in user context and appends to and rotates csharpdialog.log there, so this subfolder needs the write grant. The root never gets one.
    • MSI: PermissionEx on two permanent CreateFolder components, so an uninstall keeps the logs. .pkg: the postinstall applies the same DACLs with Set-Acl.
  2. Local time. The WPF dialog set DialogResult.Timestamp to DateTime.UtcNow; the console path and the class default use DateTime.Now. The Timestamp: line on stdout, which the Run tab shows, is now local time.

Verified

  • dotnet build, plus dotnet test: 25 passed.
  • build.ps1 -Build -Msi -Pkg -Runtime win-x64 builds. The MSI's MsiLockPermissionsEx table has rows for both folders.
  • Ran the generated postinstall ACL block against a scratch folder. Read-back DACLs: root D:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;BU), logs ...(A;OICI;0x1301bf;;;BU).
  • Not installed on a machine here. The ACL on a real install still needs checking in a VM.

… in local time

The folder inherited ProgramData's ACL, which lets any user create and write files
there. The MSI and the .pkg postinstall now give it its own ACL: SYSTEM and
Administrators full control, Users read, inheritance off. The logs subfolder alone
adds Users modify, because dialog.exe runs in user context and writes and rotates
csharpdialog.log there.

The WPF dialog stamped its result with UTC while the console path used local time,
so the Run tab showed UTC. Both now use local time.
@rodchristiansen
rodchristiansen merged commit 1c7f623 into main Oct 7, 2026
1 check passed
@rodchristiansen
rodchristiansen deleted the fix/notifications-acl-local-time branch October 7, 2026 03:33
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.

1 participant