Skip to content

fix: guard against NULL/empty DACL to prevent wiping drive root permissions#13

Merged
sigmeta merged 1 commit into
mainfrom
fix/null-dacl-safety-guard
May 20, 2026
Merged

fix: guard against NULL/empty DACL to prevent wiping drive root permissions#13
sigmeta merged 1 commit into
mainfrom
fix/null-dacl-safety-guard

Conversation

@sigmeta
Copy link
Copy Markdown
Contributor

@sigmeta sigmeta commented May 20, 2026

When a directory (e.g. C:) has a NULL DACL (no DACL section at all), GetAccessControl() returns zero rules. Adding our AppContainer ACE and calling SetAccessControl() then replaces the implicit full-access with a single-entry DACL, stripping Administrators/Users/SYSTEM permissions.

Add IsNullOrEmptyDacl() helper that inspects the SDDL string for a missing or empty D: section. Guard all three ACL-write paths:

  • GrantAccess (dir + file branches)
  • GrantAncestorTraverse
  • SetupDriveTraverse

NULL DACL semantically grants everyone full access (including AppContainer), so skipping the write is functionally correct.

Description

Related Issue

Changes

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • CI/CD or build configuration change
  • Refactoring (no functional changes)

Testing

  • Tests pass locally (cd desktop && npm run test)
  • Renderer tests pass locally (cd desktop/renderer && npm run test)
  • Build succeeds (cd desktop && npm run build)
  • Manual testing performed (describe below)

Checklist

  • My code follows the coding guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes

…ssions

When a directory (e.g. C:\) has a NULL DACL (no DACL section at all),
GetAccessControl() returns zero rules. Adding our AppContainer ACE and
calling SetAccessControl() then replaces the implicit full-access with
a single-entry DACL, stripping Administrators/Users/SYSTEM permissions.

Add IsNullOrEmptyDacl() helper that inspects the SDDL string for a
missing or empty D: section. Guard all three ACL-write paths:
- GrantAccess (dir + file branches)
- GrantAncestorTraverse
- SetupDriveTraverse

NULL DACL semantically grants everyone full access (including
AppContainer), so skipping the write is functionally correct.
@sigmeta sigmeta merged commit ba75c65 into main May 20, 2026
0 of 2 checks passed
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.

2 participants