Skip to content

Update the DACL to only allow access to the user when creating virtual disks - #41678

Merged
Blue (OneBlue) merged 13 commits into
masterfrom
user/oneblue/vhd-acl
Oct 1, 2026
Merged

Blue (OneBlue) merged 13 commits into
masterfrom
user/oneblue/vhd-acl

Conversation

@OneBlue

@OneBlue Blue (OneBlue) commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

This change updates the DACL passed to CreateVirtualDisk() to grant full access only to the creating user and BUILTIN\Administrators, with inherited access disabled. Administrator access preserves compatibility with older WSL versions that open VHDs as SYSTEM, whose token includes the Administrators group.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI lite review requested due to automatic review settings September 22, 2026 22:57

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.

Copilot review overview

🟡 Changes recommended

The ACL test reuses a VHD path across iterations and needs unique-path cleanup.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

This pull request restricts newly created virtual disks to the creating user and uses impersonation for VM access management.

Changes:

  • Applies protected, user-only DACLs to new VHDs.
  • Updates VHD access and revocation to use user impersonation.
  • Adds permission validation tests.
File Summary
test/​windows/​UnitTests.cpp Adds VHD ACL validation tests; the reviewed test needs unique paths and cleanup per iteration.
src/​windows/​service/​exe/​WslCoreVm.cpp Uses user impersonation for VHD access operations.
src/​windows/​service/​exe/​HcsVirtualMachine.cpp Passes user tokens during disk cleanup.
src/​windows/​common/​WslCoreFilesystem.h Documents the updated VHD permission contract.
src/​windows/​common/​WslCoreFilesystem.cpp Creates protected, user-only VHD ACLs.
src/​windows/​common/​hcs.hpp Extends the revoke-access API with an optional token.
src/​windows/​common/​hcs.cpp Impersonates users during access revocation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/windows/UnitTests.cpp Outdated
Copilot AI review requested due to automatic review settings September 23, 2026 18:31

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.

Copilot review overview

🔵 Needs a closer look

The ACE validation helper must handle non-allowed ACE types correctly.

Review effort: Lite
Findings: 1 Medium severity

Open (1)

Copilot AI review requested due to automatic review settings September 23, 2026 18:58

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.

Copilot review overview

🟡 Changes recommended

Preserve service-identity fallback for inaccessible VHDs and fix the test to verify the original filesystem path.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity

Open (2)
Resolved since last review (1)

Comment thread src/windows/service/exe/WslCoreVm.cpp Outdated
Comment thread test/windows/UnitTests.cpp
Copilot AI review requested due to automatic review settings September 23, 2026 20:07

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.

Copilot review overview

🔵 Needs a closer look

Set-sparse VHD access can fail because the service still opens protected VHDs without user impersonation.

Review effort: Lite
Findings: None

Resolved since last review (2)

Copilot AI review requested due to automatic review settings September 23, 2026 22:08

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.

Copilot review overview

🟡 Changes recommended

Resolve the VHD administrator ACE policy mismatch and make ACE validation type-aware.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)

Comment thread src/windows/common/WslCoreFilesystem.cpp
Comment thread src/windows/common/WslCoreFilesystem.cpp Outdated
Copilot AI review requested due to automatic review settings September 23, 2026 22:33

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.

Copilot review overview

🔵 Needs a closer look

Security-sensitive ACL and impersonation lifecycle changes require final human validation.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 24, 2026 17:15

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.

Copilot review overview

🔵 Needs a closer look

Update the ACL helper to safely handle non-allow ACE types before approval.

Review effort: Lite
Findings: None

Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 24, 2026 20:36

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.

Copilot review overview

🔵 Needs a closer look

Reviewer assessments favor final human review, and one test-coverage nit remains.

Review effort: Lite
Findings: None

@OneBlue
Blue (OneBlue) marked this pull request as ready for review September 25, 2026 06:39
@OneBlue
Blue (OneBlue) requested a review from a team as a code owner September 25, 2026 06:39
@benhillis
Ben Hillis (benhillis) requested a balanced review from Copilot September 30, 2026 17:57

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.

Copilot review overview

🟡 Changes recommended

The new non-elevated regression coverage currently runs with an elevated primary token.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Comment thread test/windows/UnitTests.cpp Outdated

@benhillis Ben Hillis (benhillis) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The product change looks reasonable, but the new non-elevated regression path uses GetNonElevatedToken(TokenPrimary), which only lowers integrity and leaves an elevated process's administrator groups enabled. Please use the restricted impersonation-token-to-primary-token pattern so the test actually validates the user-only access path.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 21:59

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.

Copilot review overview

🔵 Needs a closer look

The security-sensitive ACL and impersonation changes span several VM lifecycle paths and warrant final human validation.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@OneBlue
Blue (OneBlue) merged commit 807f5de into master Oct 1, 2026
12 checks passed
@OneBlue
Blue (OneBlue) deleted the user/oneblue/vhd-acl branch October 1, 2026 00:22
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.

3 participants