[WSLC] Add cooperative HTTP/HTTPS proxy support#652
Open
SohamDas2021 wants to merge 3 commits into
Open
Conversation
|
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.
Pull request overview
Adds WSLC “cooperative” HTTP/HTTPS proxy support by translating network.proxy into standard proxy environment variables (with hygiene scrubbing), aligning WSLC behavior with the existing Bubblewrap cooperative proxy model and documenting/testing it end-to-end.
Changes:
- Added shared
wxc_common::proxy_envhelpers for scrubbing/setting proxy env vars and refactored Bubblewrap to use them. - Extended config parsing to allow
network.proxyforwslcand added WSLC-specific validation (url-form only). - Added WSLC proxy functional test config + scripts and documented WSLC proxy behavior/caveats.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/scripts/run_wslc_proxy_test.ps1 | New WSLC proxy functional test runner script |
| tests/scripts/run_wslc_all_tests.ps1 | Adds WSLC proxy config to the all-tests suite |
| tests/configs/wslc_network_proxy.json | New WSLC proxy test config exercising env injection + scrubbing |
| src/core/wxc_common/src/proxy_env.rs | New shared proxy env scrubbing/injection helpers + unit tests |
| src/core/wxc_common/src/lib.rs | Exposes the new proxy_env module |
| src/core/wxc_common/src/config_parser.rs | Allows WSLC proxy + validates WSLC proxy must be { url } form |
| src/backends/wslc/common/src/wsl_container_runner.rs | Injects cooperative proxy env vars into WSLC process settings |
| src/backends/bubblewrap/common/src/bwrap_command.rs | Refactors Bubblewrap proxy env handling to shared helpers |
| sdk/node/src/types.ts | Updates SDK docs/comments to mention WSLC proxy constraints |
| docs/wsl/wsl-container-getting-started.md | Documents WSLC cooperative proxy model and limitations |
| docs/schema.md | Notes WSLC proxy support and url-only constraint in schema docs |
Comment on lines
+777
to
+782
| // WSLc runs each container in its own network namespace (a separate | ||
| // WSL system VM), so a host/loopback proxy is unreachable from | ||
| // inside the container. Only an external, routable proxy URL works. | ||
| // Reject the localhost / builtinTestServer forms (which imply an | ||
| // in-container or MXC-run proxy) with a clear message. A `url`-form | ||
| // proxy carries `original_url`; the other forms do not. |
Comment on lines
+967
to
+983
| let effective_env: Vec<String> = if request.policy.network_proxy.is_enabled() { | ||
| let proxy_url = request | ||
| .policy | ||
| .network_proxy | ||
| .address | ||
| .as_ref() | ||
| .map(|addr| addr.to_url()) | ||
| .unwrap_or_default(); | ||
| let _ = writeln!( | ||
| logger, | ||
| "[WSLC] Cooperative network proxy configured: {}", | ||
| proxy_url | ||
| ); | ||
| wxc_common::proxy_env::apply_cooperative_proxy_env(&request.env, &proxy_url) | ||
| } else { | ||
| request.env.clone() | ||
| }; |
| $WxcExec = $Candidates | Where-Object { Test-Path $_ } | Select-Object -First 1 | ||
| } | ||
| if (-not $WxcExec -or -not (Test-Path $WxcExec)) { | ||
| Write-Host "ERROR: wxc-exec.exe not found. Build with: cargo build --features wslc --release --target $Target" -ForegroundColor Red |
SohamDas2021
marked this pull request as ready for review
July 20, 2026 18:20
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
WSLc containers run in their own network namespace (a separate WSL system VM) and the WSLc kernel has no in-kernel iptables, so per-host network enforcement is not possible. Mirror the Bubblewrap backend's cooperative model: translate
network.proxyinto HTTP(S)_PROXY env vars that cooperating clients (curl, wget, requests, ...) honor.🔗 References
🔍 Validation
✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes (see docs/pull-requests.md)📋 Issue Type
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 GitHubActions build; it runs on merge to
main, and Microsoft reviewers with write access can trigger iton a PR with
/azp run. See docs/pull-requests.md.If the
dependency-feed-checkcheck fails on a new dependency, the crate must be added tothe feed before the PR can pass. See docs/pull-requests.md
for the steps.
Microsoft Reviewers: Open in CodeFlow