Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements enforcement for new WSLC-related group policies across the WSLC COM service boundary and CLI, including new HRESULTs and localized user-facing error messages, plus policy-focused tests.
Changes:
- Enforce
AllowWSLContaineratWSLCSessionManagerCOM activation time so clients fail fast withWSL_E_CONTAINER_DISABLED. - Implement
WSLContainerCLIRegistryAllowlistevaluation and enforce it for image pull/push; block image builds when an allowlist is configured. - Add new HRESULTs and localized messages, plus new policy tests (including pure-function allowlist evaluator tests).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/PolicyTests.cpp | Adds WSLC policy tests for container disable + registry allowlist behavior, including CLI coverage and evaluator unit tests. |
| src/windows/wslcsession/WSLCSession.cpp | Enforces registry allowlist for Pull/Push and blocks BuildImage when allowlist is active. |
| src/windows/service/inc/wslservice.idl | Defines WSL_E_CONTAINER_DISABLED and WSL_E_REGISTRY_BLOCKED_BY_POLICY. |
| src/windows/service/exe/WSLCSessionManagerFactory.cpp | Gates COM factory creation on AllowWSLContainer policy. |
| src/windows/inc/wslpolicies.h | Adds allowlist subkey constants and helper functions to read/evaluate the registry allowlist. |
| src/windows/common/wslutil.cpp | Registers new HRESULTs in common error mapping and adds a localized string for WSL_E_CONTAINER_DISABLED. |
| localization/strings/en-US/Resources.resw | Adds localized strings for the new policy-related user-facing error messages. |
benhillis
commented
May 8, 2026
benhillis
commented
May 8, 2026
08e7ed9 to
cf811de
Compare
cf811de to
5891de1
Compare
5891de1 to
753c107
Compare
Adds enforcement for two group policies whose ADMX templates landed in PR #40422: - AllowWSLContainer (DWORD): master switch for wslc.exe and the WSLCSessionManager COM API. Enforced inside WSLCSessionManagerFactory so CoCreateInstance returns WSL_E_CONTAINER_DISABLED directly when the policy is off; every caller (wslc.exe, WslcSDK, plugins) fails fast through one code path rather than getting a manager whose every method errors out individually. - WSLContainerRegistryAllowlist: ADMX `<list valuePrefix=\"AllowedRegistry\">` policy stored as a sub-key whose REG_SZ value data is each allowed registry hostname. Enforced in PullImage and PushImage via a shared helper. BuildImage is rejected outright when an allowlist is configured, since the in-VM docker daemon fetches FROM base images through its own pull mechanism and cannot be reliably gated per-registry. The policy is fail-open: an absent or empty sub-key is treated as no restriction, and registry I/O errors fall through to allow rather than break all container operations on a transient hiccup. Adds two new HRESULTs: - WSL_E_CONTAINER_DISABLED (0x33) - WSL_E_REGISTRY_BLOCKED_BY_POLICY (0x34) Adds PolicyTests covering disabled-state, CLI surfacing, allowlist denial, build rejection, and pure-function unit tests for the allowlist evaluator. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
753c107 to
8a6fcae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement WSLC container group policies
Adds enforcement for two group policies whose ADMX templates landed in #40422:
AllowWSLContainer (DWORD): master switch for wslc.exe and the WSLCSessionManager COM API. Enforced inside WSLCSessionManagerFactory so CoCreateInstance returns WSL_E_CONTAINER_DISABLED directly when the policy is off; every caller (wslc.exe, WslcSDK, plugins) fails fast through one code path rather than getting a manager whose every method errors out individually.
WSLContainerCLIRegistryAllowlist: ADMX
<list valuePrefix=\"AllowedRegistry\">policy stored as a sub-key whose REG_SZ value data is each allowed registry hostname. Enforced in PullImage and PushImage via a shared helper. BuildImage is currently rejected outright when an allowlist is configured. This will be addressed in a follow-up change.Adds two new HRESULTs:
Adds PolicyTests covering disabled-state, CLI surfacing, allowlist denial, build rejection, and pure-function unit tests for the allowlist evaluator.