Repository navigation
[WSLC] Custom proxies and host loopback for the built-in proxy - #1816
Open
Elliot (theelliotm) wants to merge 2 commits into
Open
Elliot (theelliotm) wants to merge 2 commits into
Elliot (theelliotm) wants to merge 2 commits into
Conversation
With egress denied in create-and-run mode, runtimeConfig.networkProxy now runs behind the built-in proxy, which relays the workload only to the custom proxy. Hostname proxies keep their URL and resolve to the built-in proxy; IP proxies are rewritten to its address. Loopback proxies are rejected for now. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c3f64c2c-9005-43eb-a803-a91fb7265c5b
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
V1 requests now use unfiltered bridged networking instead of the built-in proxy, breaking compatibility and removing direct-traffic restrictions, while bridged proxy configurations also strip required Windows-loopback exemptions.
2 open issues
What changed in this PR
Extends MXC’s WSLC create-and-run networking with custom-proxy relaying and Windows host-loopback access, building on the built-in proxy design. Container lifecycle behavior remains unchanged.
Changes:
- Adds custom-proxy validation, hostname preservation, IP rewriting, and port-mapping support.
- Enables host loopback for proxied and bridged runs, with runtime and administrative-policy checks.
- Extends functional validation, removes obsolete SDK rejection cases, and updates backend documentation.
| File | Description |
|---|---|
| tests/scripts/run_wslc_all_tests.ps1 | Adds proxy and host-loopback validation scenarios. |
| tests/configs/wslc_network_egress_rules_host_loopback_rejected.json | Removes obsolete host-loopback rejection fixture. |
| tests/configs/wslc_network_egress_port_mapping_network_proxy.json | Tests custom proxies alongside port mappings. |
| tests/configs/wslc_network_egress_port_mapping_network_proxy_rejected.json | Removes obsolete proxy/port-mapping rejection fixture. |
| tests/configs/wslc_network_egress_port_mapping_host_loopback.json | Tests host loopback alongside port mappings. |
| tests/configs/wslc_network_egress_port_mapping_host_loopback_rejected.json | Removes obsolete loopback/port-mapping rejection fixture. |
| tests/configs/wslc_network_egress_network_proxy_unresolvable_rejected.json | Tests rejection of unresolvable proxy hostnames. |
| tests/configs/wslc_network_egress_network_proxy_loopback_rejected.json | Tests rejection of unsupported loopback addresses. |
| tests/configs/wslc_network_egress_network_proxy_https_ip_rejected.json | Tests rejection of HTTPS proxies using IP addresses. |
| tests/configs/wslc_network_egress_network_proxy_egress_allow_rejected.json | Tests rejection of incompatible proxy/network defaults. |
| tests/configs/wslc_network_egress_host_loopback.json | Tests host-loopback access with egress filtering. |
| tests/configs/wslc_network_egress_custom_proxy_loopback.json | Tests relaying to a Windows-loopback proxy. |
| tests/configs/wslc_network_egress_custom_proxy_ip.json | Tests IP-based proxy rewriting and isolation. |
| tests/configs/wslc_network_egress_custom_proxy_https_name.json | Tests hostname preservation and TLS verification. |
| tests/configs/wslc_network_bridged.json | Adds a bridged host-loopback probe. |
| tests/configs/wslc_network_bridged_host_loopback_denied.json | Tests bridged networking without host loopback. |
| src/mxc-sdk/src/backends/wslc/common/wslc_bindings.rs | Adds loopback/capability SDK bindings and error constants. |
| src/mxc-sdk/src/backends/wslc/common/wsl_container_runner.rs | Configures session loopback and workload proxy environments. |
| src/mxc-sdk/src/backends/wslc/common/policy.rs | Updates network selection and custom-proxy validation. |
| src/mxc-sdk/src/backends/wslc/common/egress_gateway.rs | Configures relays, DNS, proxy environments, and capabilities. |
| sdk/node/tests/integration/wslc-e2e.test.ts | Removes the obsolete host-loopback rejection case. |
| sdk/dotnet/Microsoft.Mxc.Sdk.Tests/V1/MxcContainerWslcE2ETests.cs | Removes the obsolete host-loopback rejection case. |
| docs/backends/wslc/wsl-container-getting-started.md | Documents networking behavior, usage, and limitations. |
Review effort: Balanced
Comment on lines
+199
to
+201
| return Ok(NetworkMode::Bridged { | ||
| host_loopback: ingress.host_loopback == NetworkAction::Allow, | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
Not true ; will respond tomorrow.
Comment on lines
+1139
to
+1140
| let effective_env: Vec<String> = if let Some(gateway) = &gateway { | ||
| gateway.workload_env(request.env_entries(), process_env::EnvScope::of(request)) |
Elliot (theelliotm)
marked this pull request as draft
November 19, 2026 01:29
Elliot (theelliotm)
marked this pull request as ready for review
November 19, 2026 01:31
This branch has not been deployed
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.


📖 Description
Adds custom proxies and host loopback to WSLC create-and-run requests that use the built-in proxy. Also allows host loopback with bridged create-and-run.
Custom proxies (
runtimeConfig.networkProxy)127.0.0.1orlocalhostare relayed to Windows127.0.0.1. Other loopback addresses,0.0.0.0, IPv6 and hostnames that resolve to loopback are rejected.networkProxywith egressallowand a non-allowingress default is rejected.networkProxy.Host loopback (
network.ingress.hostLoopback: "allow")host.wslc.internal(NET_ADMINis added to the proxy container only).allownow uses bridged networking whateverhostLoopbackis.host.wslc.internalis reachable only withhostLoopback: "allow".backend_unavailableif the WSL runtime is too old or capability additions are disabled.🔗 References
Refs #1462
Closes #1810
Closes #1811
Spec:
docs/development/architecture/designs/1462-wslc-builtin-proxy/README.md(#1625)🔍 Validation
cargo test -p mxc-sdk --features wslc --lib -- wslc: passed (475)cargo fmt --all -- --checkandcargo clippy -p mxc-sdk --features wslc --all-targets -- -D warnings: passednode scripts/versioning/validate-configs.js: passed (471 configs)tests/scripts/run_wslc_all_tests.ps1(built-in proxy, port mappings, new custom proxy runs, rejections) passed.wxc-execagainst a Windows127.0.0.1test server and passed: built-in proxy with and without a port mapping, loopback custom proxy, bridged withhostLoopbackallow (host.wslc.internalreturns 200) and omitted (name doesn't resolve), and the loopback and egress-allow rejections.hostLoopback: "allow"can't resolve or reachhost.wslc.internal, and can still reach the internet.tests/scripts/run_wslc_all_tests.ps1, and the Node/.NET WSLC E2E suites (only the removed rejection cases changed there).✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow