Repository navigation
[IsoSession] Add the isolation_session network test baseline - #1796
Ion Vasilian (ionvasilian) wants to merge 3 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
The new validation can falsely pass rejection and runtime failures, is not invoked by CI, and directly changes machine-wide settings instead of using caller-managed setup.
5 open issues
Run the admission checks in scheduled CI validation · New Require the expected rejection reason for negative tests · New Treat successful non-loopback TCP connects as reachable · New Move OS-level runtime setup into the caller-provided setup script · New Fail runtime validation on a nonzero wxc-exec exit · New
What changed in this PR
Adds network-policy validation coverage for MXC’s IsolationSession backend and a compile-time lab gate for exact TCP loopback ports, while preserving shipping admission rules.
Changes:
- Adds 31 shipping/lab admission cases, a build-mode canary, and optional runtime reachability and cleanup checks.
- Adds lab-only backend and parser handling, with corresponding test adjustments.
- Packages the script in Windows test bundles, with optional staging for older Azure branches.
Validation was limited to code inspection; Windows runtime tests were not run.
| File | Description |
|---|---|
tests/scripts/run_isolation_session_network_test.ps1 |
Adds admission, reachability, and cleanup checks. |
src/mxc-sdk/src/policy/sdk_v1_conformance.rs |
Skips one parser-rejection fixture in lab builds. |
src/mxc-sdk/src/policy.rs |
Makes an explicit-network test shipping-only. |
src/mxc-sdk/src/core/mxc_contract/published/v1_0_0/request.rs |
Defers non-proxy network validation to the backend in lab builds. |
src/mxc-sdk/src/core/mxc_contract/published/v0_9_0_alpha/request.rs |
Applies the same lab-only parser deferral. |
src/mxc-sdk/src/core/mxc_contract/dev/request.rs |
Applies lab-only parser deferral to the development contract. |
src/mxc-sdk/src/core/mxc_common/config_parser.rs |
Disables two parser-rejection tests under the lab cfg. |
src/mxc-sdk/src/backends/isolation_session/common/policy.rs |
Adds the narrow loopback admission gate and tests. |
src/mxc-sdk/src/backends/isolation_session/common/one_shot.rs |
Enables validated egress rules in lab builds and adds tests. |
src/mxc-sdk/Cargo.toml |
Registers the lab cfg for compiler checking. |
scripts/ci/build-windows-sdk-test-bundle.ps1 |
Stages and requires the new script in SDK test bundles. |
.azure-pipelines/templates/IsolationSession.TestBundle.Build.Job.yml |
Stages the script when present on the selected branch. |
Review effort: Balanced
b7bd3f4 to
1a3f09b
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Lab enforcement relies on external OS-private configuration, and revised runtime probes were not rerun, requiring maintainer verification of enforcement, restoration, and cleanup on a compatible prerelease Windows host.
No open issues 🎉
5 resolved since last review
Review effort: Balanced
|
Superseded: these results are for 1a3f09b. 83d1575 removed the runtime rows from this PR; see the review discussion. Re-ran the runtime rows at 1a3f09b on a pre-release Windows build, to address the review note that the revised probes had not been re-run. Command: Result: 40/40 passed (exit 0).
Restoration and cleanup, checked independently after the run:
Scope note: the host enforcement comes from an external, OS-side setup script that this PR does not ship. The lab cfg is not part of shipping builds, and the shipping admission rows (CI dry-run) do not depend on it. |
adpa-ms
left a comment
There was a problem hiding this comment.
[AgentAssisted] A few questions about the PR's purpose before the details. The answers decide its shape.
1. What has to work that doesn't today? MXC passes no network policy to the OS. The IsolationSession bindings have no network members, and the create-and-run path passes none to add_user, start_session or create_process. As your comment says, the enforcement comes from the host setup script. On a host it has prepared, would a shipping wxc-exec with the all-allow request get the same results as the -Lab -Runtime rows? If so, what does the lab build add?
2. Why land the runtime rows in MXC now? ProcessContainer's network tests fit here: MXC builds the requested rules into the spec it passes to CreateProcessSecurityEnvironment, so the tests cover MXC's translation too. Here MXC passes nothing yet. These rows' network results depend only on the OS and the setup script, and neither MXC CI nor the planned OS row runs them. Should they land with the public network surface MXC will pass the policy through, and run on the OS side until then?
3. Why change the published 0.9.0-alpha and 1.0.0 parsers? A release wxc-exec accepts 1.1.0-alpha IsolationSession requests without --experimental, and the script chooses its own version. Three of the four test exemptions exist only because the published parsers changed. Under the lab cfg, the invalid-fixture and missing-network tests in mxc_contract_v0_9_0_alpha and mxc_contract_v1_0_0 would also fail; the --lib run doesn't build them. Does any caller need a published contract?
4. What do the shipping dry-run rows catch that existing tests miss? PR CI already enforces the rule: contract tests and fixtures for all three versions, plus config parser, SDK and backend unit tests. The nightly one-shot suite checks it against the real binary. In a shipping build, 27 of the 31 rows expect the same parser message. A dry run stops before any OS call, so these rows test nothing specific to an IsolationSession host.
A smaller shape, depending on your answers:
- To measure the compartment before the public surface exists, an OS-side test can launch the shipping
wxc-execwith the all-allow request. That needs no MXC change. - If MXC must accept the restricted request now, gate only the dev contract and the backend. The dev parser accepts exactly all-allow or the loopback shape, and the script sends 1.1.0-alpha. No test needs an exemption: none of the dev contract's invalid fixtures has the loopback shape.
- Drop the shipping rows. To pin that shipping builds reject the loopback shape, add one invalid fixture.
1a3f09b to
83d1575
Compare
|
adpa-ms thanks; points 1-4 accepted. Reshaped per your proposal (83d1575): dev contract (1.1.0-alpha) and backend only, published parsers untouched, shipping rows replaced by one invalid fixture. Runtime rows run OS-side until MXC passes the public network options, then land in MXC with that change. |
There was a problem hiding this comment.
🔵 Needs a closer look
The checks cover admission only, leaving the private, external host setup and exact-port OS enforcement, including Windows runtime behavior, for a maintainer to verify.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
Gudge (MGudgin)
left a comment
There was a problem hiding this comment.
Gudge needs more time to review this PR before it is merged. Please hold off on merging until that review is complete.
adpa-ms
left a comment
There was a problem hiding this comment.
[AgentAssisted] Thanks: the reshape resolves points 2–4. The runtime rows are gone, the published contracts are untouched, and one fixture replaces the shipping rows.
Point 1 is still open, and it decides whether the lab gate belongs in this PR. MXC still passes no network policy to the OS. A lab binary with the loopback request makes the same OS calls as a shipping binary with the all-allow request. The gate changes what MXC accepts, not what the session enforces.
With the runtime rows gone, who needs a lab build to accept the restricted request before MXC can apply its policy, and for what?
If nothing needs it sooner, could the gate land with the change that passes the public network options to the session, as the runtime rows will? That change is what makes MXC apply the policy the gate admits.
If something needs it sooner, a narrower gate would be enough. In lab builds, the dev parser would accept only all-allow or the loopback shape, and everything else would keep the shipping message. Today, lab builds skip the parser's network check for any request without a proxy. That turns two invalid fixtures into valid all-allow requests: isolation_session_egress_allow_rules.json and isolation_session_egress_deny_rules.json. Normalization treats their empty allow and deny lists as absent.
Add tests/scripts/run_isolation_session_network_test.ps1, a network test pass for the isolation_session backend. Its 35 rows are adapted from the process_container network areas (capability matrix, model-3 equivalence, egress rules, host loopback, proxy), using the WSLC GA-egress matrix as the row template where it fits. Each row runs the shipping wxc-exec, and its outcome is judged at runtime; there is no build flag: - admitted: the probe inside the sandbox must show the requested posture (reachable where allowed, blocked where denied). Admitted but narrower or broader than requested is FAIL. - rejected with the named isolation_session network rejection: UNSUPPORTED, reported with the capability it needs. Any other error is FAIL. - KNOWN-GAP only for a recorded gap (a killed wxc-exec can leak its agent user). When a later change admits a shape, its row starts enforcing without editing the script. On today's MXC the all-allow row passes and every restricted row reports UNSUPPORTED. Row E13 pins that the link-local metadata address 169.254.169.254 is never reachable: an explicit allow of 169.254.0.0/16 must be rejected (linkLocal) or, if admitted, the probe to 169.254.169.254:80 must be blocked. The script skips in session 0 and where the backend is unavailable, and prints the summary line the Windows integration harness parses. The TestBundle build stages the script (optional on older bundled branches), so the Windows integration tests that consume the bundle can run it. Add the invalid v1.1.0-alpha fixture isolation_session_declared_loopback_ports.json, which pins that a declared-loopback shape is rejected today. No product code changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e4e00d4-9956-456c-93ca-1c66128be594
83d1575 to
ce3e187
Compare
|
adpa-ms Thanks. On point 1: you were right that a build-flag gate in product code with
Later PRs will regenerate the bindings and then pass the network options. As |
There was a problem hiding this comment.
🟡 Changes recommended
Network tests can produce false passes or failures due to incomplete UDP/reset verification, incorrect expectations for invalid proxy policies, and a missing host reachability control for the metadata endpoint.
4 open issues
Review effort: Balanced
Address review findings on the network test pass: - udp: send a DNS query and require a reply from the same peer with the same transaction id (ANSWERED). A sent datagram is no evidence of reachability. A host positive control makes udp report-only when the host itself gets no answer. - E13: the row checks non-reachability, so a blocked metadata probe passes; whether the host reaches 169.254.169.254:80 is recorded in the row detail and does not change the verdict. - P01/P02: mark as invalid proxy shapes (networkProxy needs egress.default=deny with no direct rules). Admitted is FAIL; the shared proxy rejection is PASS. - L02: probe the down port with a nonce so a relay reset (10054) is read, not hidden by a local accept. - Strip comments and indentation from the encoded probe and fail fast if the command line exceeds 8191 characters. Results unchanged on a prerelease VM: keys off 5 PASS / 30 UNSUPPORTED / 0 FAIL; network keys on 4 / 30 / 1 (A01, OS-side, tracked). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e4e00d4-9956-456c-93ca-1c66128be594
TCP may deliver the loopback listener's nonce across several reads. A single read could see part of it and report CONNECTED instead of REACHED, failing a row whose posture held. Read until the nonce is seen, the peer closes, or the read times out. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e4e00d4-9956-456c-93ca-1c66128be594

Summary
This PR adds a network test pass for the isolation_session backend. It is a
baseline that later changes light up row by row. It changes no product code.
tests/scripts/run_isolation_session_network_test.ps1(new). It has 35rows adapted from the process_container network areas:
The WSLC GA-egress matrix is the row template where it fits. Row groups:
169.254.169.254 is never reachable, whatever the policy allows.
The TestBundle build (pipeline template and
build-windows-sdk-test-bundle.ps1) stages the script.An invalid v1.1.0-alpha fixture,
isolation_session_declared_loopback_ports.json.Outcome vocabulary
Each row runs the shipping
wxc-execand is judged at runtime. There is nobuild flag or lab switch.
defaultDeny,loopbackPortsoregressRules.wxc-execcan leak its agent user.When a later change admits a shape, its row starts enforcing without any edit
to the script.
The udp probe sends a DNS query and counts as reached only on a matching reply.
It is report-only when the host itself gets no answer.
Consumer
The Windows integration tests consume the IsolationSession TestBundle through
the MXC package. Landing order:
The script follows that harness's contract:
-WxcExePath/-ConfigDir.<n>/<m> passed.SKIPPED:andexits 0.
Validation
cargo test --lib: 2822 passed, 1 ignored, 1 failure.host_to_container_loopback_connects(10060). It isunrelated to this PR and also fails without it.
0 FAIL.
build a start without network options is restricted. This is on the OS
side: the platform will keep host networking for a start without network
options, and A01 will pass then. The other 34 rows are unchanged.