Skip to content

Add Microsoft.Filesystem/ACL resource - #1751

Merged
Steve Lee (SteveL-MSFT) merged 5 commits into
PowerShell:mainfrom
SteveL-MSFT:stevel-msft-filesystem-acl-resource
Oct 14, 2026
Merged

Steve Lee (SteveL-MSFT) merged 5 commits into
PowerShell:mainfrom
SteveL-MSFT:stevel-msft-filesystem-acl-resource

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

Adds native Windows ACL management so DSC configurations can declaratively manage discretionary access control lists on files and folders without introducing another executable.

The existing file content resource is renamed and consolidated under file_dsc. Its original content commands remain compatible, while a new acl get|set|test command surface powers Microsoft.Filesystem/ACL. The resource accepts a keyed path and required DACL-only SDDL, uses Windows security descriptor APIs, and explicitly rejects owner, group, and SACL components it does not manage.

The build and packaging metadata now publishes file_dsc cross-platform and includes the ACL manifest only on Windows. Pester coverage verifies Allow and Deny ACE behavior on both files and folders, desired-state testing, unsupported SDDL validation, and the renamed project path.

Validation:

  • ./build.ps1 -Project file_dsc -Clippy
  • File resource Pester suite
  • Build helper Pester tests

Steve Lee (POWERSHELL HE/HIM) (from Dev Box) and others added 2 commits October 13, 2026 10:29
Add Microsoft.Filesystem/ACL to the shared file_dsc executable with native Windows SDDL get, set, and test support. Rename the existing filecontent binary and add Allow/Deny ACE coverage for files and folders.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Update workspace, build metadata, and build helper tests to use the renamed resource directory.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 17:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

DACL protection flags are not applied, canonical schema requirements are unmet, and stale filecontent test invocations remain.

3 open findings
What changed in this PR

Adds native Windows DACL management while consolidating file resources under file_dsc.

Changes:

  • Adds Microsoft.Filesystem/ACL.
  • Renames and packages the file-content executable as file_dsc.
  • Adds ACL and file-content Pester coverage.
File Description
tests/​helpers.build.pester.tests.ps1 Updates renamed project paths.
resources/​file_dsc/​tests/​filesystem_acl.tests.ps1 Adds ACL integration tests.
resources/​file_dsc/​tests/​filecontent_test.tests.ps1 Adds content test coverage.
resources/​file_dsc/​tests/​filecontent_set.tests.ps1 Adds set-operation coverage.
resources/​file_dsc/​tests/​filecontent_get.tests.ps1 Uses the renamed executable.
resources/​file_dsc/​tests/​filecontent_export.tests.ps1 Adds export coverage.
resources/​file_dsc/​src/​types.rs Defines ACL state input/output.
resources/​file_dsc/​src/​main.rs Routes ACL subcommands.
resources/​file_dsc/​src/​file.rs Implements file-content operations.
resources/​file_dsc/​src/​acl.rs Implements Windows DACL operations.
resources/​file_dsc/​locales/​en-us.toml Adds localized ACL messages.
resources/​file_dsc/​filesystem_acl.dsc.resource.json Defines the ACL resource.
resources/​file_dsc/​filecontent.dsc.resource.json References file_dsc.
resources/​file_dsc/​Cargo.toml Renames the crate and adds Windows APIs.
resources/​file_dsc/​.project.data.json Updates project packaging metadata.
data.build.json Updates platform package contents.
Cargo.toml Updates workspace membership.
Cargo.lock Records renamed package dependencies.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread resources/file_dsc/src/acl.rs
Comment thread resources/file_dsc/filesystem_acl.dsc.resource.json Outdated
Comment thread resources/file_dsc/src/acl.rs
Apply DACL protection state, reference the canonical desired-state schema, add negative and protected-DACL tests, and update remaining direct executable tests for file_dsc.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

ACL error handling misclassifies inaccessible paths and validates unknown operations only after input parsing.

0 open findings

3 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Validate ACL operation before parsing input

resources/​file_dsc/​src/​main.rs:65

The ACL operation is validated only after input parsing and deserialization, so file_dsc acl typo reports “Missing --input argument” (and malformed input reports a JSON error) instead of the added “Unknown ACL operation” diagnostic. Reject unsupported operations before processing their input, matching the top-level command behavior.

Medium severity Preserve access errors when checking ACL path existence

resources/​file_dsc/​src/​acl.rs:78

Path::exists() returns false when metadata lookup fails as well as when the path is absent, so an access-denied path is incorrectly reported as nonexistent. That is especially misleading for an ACL resource; preserve the OS error with try_exists() so callers can distinguish permissions failures from a missing target.

🧠 Review effort: Balanced

Steve Lee (POWERSHELL HE/HIM) (from Dev Box) and others added 2 commits October 13, 2026 13:57
Validate ACL operations before input parsing and preserve filesystem metadata errors when checking the target path. Add regression coverage for both cases.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Combine the file content and filesystem ACL manifests into one file_dsc.dsc.manifests.json bundle and package that bundle on every supported platform.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SteveL-MSFT
Steve Lee (SteveL-MSFT) merged commit cf32a64 into PowerShell:main Oct 14, 2026
20 checks passed
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the stevel-msft-filesystem-acl-resource branch October 14, 2026 00:41
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