Skip to content

[WSLC] Reject unenforceable network schema at parse time - #681

Open
SohamDas2021 wants to merge 1 commit into
mainfrom
user/sodas/wslc-network-schema-reject
Open

[WSLC] Reject unenforceable network schema at parse time#681
SohamDas2021 wants to merge 1 commit into
mainfrom
user/sodas/wslc-network-schema-reject

Conversation

@SohamDas2021

@SohamDas2021 SohamDas2021 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

📖 Description

The parser now rejects, at parse time, WSLc network configs that WSLc cannot honor (previously these were either silently ignored or failed late at exec when the runner lacked CAP_NET_ADMIN):

🔗 References

🔍 Validation

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task

GitHub Actions runs the PR validation build automatically. The ADO pipeline
(MXC-PR-Build) is the Azure version of the PR pipeline, kept in parity with the GitHub
Actions build; it runs on merge to main, and Microsoft reviewers with write access can trigger it
on a PR with /azp run. See docs/pull-requests.md.

If the dependency-feed-check check fails on a new dependency, the crate must be added to
the feed before the PR can pass. See docs/pull-requests.md
for the steps.

Microsoft Reviewers: Open in CodeFlow

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@SohamDas2021
SohamDas2021 marked this pull request as ready for review July 27, 2026 20:20
@SohamDas2021
SohamDas2021 requested a review from a team as a code owner July 27, 2026 20:20
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Base automatically changed from user/sodas/wslc-enable-http-proxy to main July 28, 2026 18:50
WSLC cannot enforce per-host egress filtering: the runner would apply
in-container iptables, but the SDK's Privileged flag does not grant
CAP_NET_ADMIN, so the run aborts at exec. Reject up front instead --
an allowlist with defaultPolicy='block', or a blocklist with
defaultPolicy='allow'. Bare defaults with no host lists (full cutoff /
full NAT) stay enforceable and are left as-is.

Also reject network.allowLocalNetwork=true: a WSLC container runs in
the NAT'd WSL2 VM and MXC never consults the flag (only explicit
experimental.wslc portMappings wire inbound forwards), so honoring it
would promise reachability the backend never delivers.

Documents both rejections in the WSLC getting-started guide.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f3ae1af2-7b79-4340-a5ce-a5402e7ede3d
@SohamDas2021
SohamDas2021 force-pushed the user/sodas/wslc-network-schema-reject branch from fcba698 to f191dca Compare July 28, 2026 20:42
Copilot AI review requested due to automatic review settings July 28, 2026 20:42

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.

Pull request overview

Adds early validation for WSLC network options that cannot be enforced.

Changes:

  • Rejects effective host filtering and allowLocalNetwork: true.
  • Adds parser tests for accepted and rejected combinations.
  • Documents WSLC network limitations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/core/wxc_common/src/config_parser.rs Adds WSLC validation and tests.
docs/wsl/wsl-container-getting-started.md Documents unsupported network policies.

Comment on lines +280 to +284
WSLC **cannot** enforce per-host egress filtering. `allowedHosts` with
`defaultPolicy: "block"` (an allowlist) or `blockedHosts` with
`defaultPolicy: "allow"` (a blocklist) would require in-container `iptables`
rules, but a WSLC container runs in its own network namespace **without**
`CAP_NET_ADMIN` (the SDK's `Privileged` flag does not grant it), so those rules
Comment on lines +976 to +979
let msg = "WSLc: network.allowLocalNetwork=true is not supported. A WSLc \
container runs in the NAT'd WSL2 VM and MXC does not honor a \
blanket inbound-listen grant; expose specific ports with \
experimental.wslc portMappings instead.";
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