Skip to content

Update Bubblewrap tests to schema 0.9 - #1283

Merged
Elliot (theelliotm) merged 8 commits into
mainfrom
user/emichlin/bwrap-testing-0.9
Sep 26, 2026
Merged

Elliot (theelliotm) merged 8 commits into
mainfrom
user/emichlin/bwrap-testing-0.9

Conversation

@theelliotm

@theelliotm Elliot (theelliotm) commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

📖 Description

Updates the Bubblewrap test suite to schema 0.9.0-alpha, keeping 0.7/0.8 coverage for legacy compatibility and retiring the 0.6 cases.

Why 0.9 fixes #1273. Below 0.9 a Bubblewrap container receives no environment at all (--clearenv with nothing put back), so RHEL's bash falls back to a fabricated PATH that omits /usr/sbin — and the proxy test's iptables invocation fails to resolve. Schema 0.9 introduces the backend default environment block, which supplies a PATH that includes the system sbin directories. Thanks to this + the proxy rework below, the test now passes.

Proxy rework. run_bwrap_network_proxy_test.sh now starts a second unix-test-proxy as the real loopback endpoint, alongside the existing control listener. The legacy builtinTestServer cases stay on 0.7/0.8, where they still belong.

Config moves: five 0.6 configs rebased to 0.7 (legacy proxy shape, no slirp4netns needed), the rest to 0.9. Also fixes a silent false-pass in bubblewrap_network_firewall_cidr.json.

Added coverage: https://github.com/microsoft/mxc/actions/runs/36192718659/job/108266579735

  • e2e_bubblewrap_characterization.rs: a policy grant is not adopted as the working directory; a relative process.cwd is anchored to the sandbox root from 0.9 (asserting cwd and HOME agree); a missing command fails promptly rather than hanging.
  • linux-bubblewrap.test.ts: two 0.9 proxy tests (routing through runtimeConfig.networkProxy, and egress confined to the proxy endpoint). The existing proxy block was migrated 0.6 → 0.7 and relabeled as the legacy shape.

🔗 References

Resolves #1273

🔍 Validation

CI test shows all green for bubblewrap:

Run from the Windows checkout:

  • cargo fmt -p wxc_e2e_tests -- --check — clean
  • npx tsc --noEmit (sdk/node/tests/integration) — clean for linux-bubblewrap.test.ts; the remaining errors are pre-existing in wslc-state-aware.test.ts, which this PR does not touch
  • All 309 versioned tests/configs/*.json validated against schemas/stable with AJV, honoring config-validation-exemptions.json — 0 problems
  • bash -n on both changed shell scripts — clean

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task

Copilot AI balanced review requested due to automatic review settings September 25, 2026 19:07
@azure-pipelines

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

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.

Copilot review overview

🟡 Changes recommended

The missing-command regression test lacks a host-side timeout and can hang the entire test job.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Updates Bubblewrap tests for schema 0.9 while preserving legacy 0.7/0.8 coverage.

Changes:

  • Migrates applicable Bubblewrap configurations to schema 0.9.
  • Reworks proxy tests around runtimeConfig.networkProxy.
  • Adds characterization tests and updates backend documentation.
File Description
tests/​scripts/​run_bwrap_network_test.sh Updates legacy firewall test labels to 0.7.
tests/​scripts/​run_bwrap_network_proxy_test.sh Adds a real loopback proxy endpoint for 0.9 tests.
tests/​configs/​linux_process_default.json Moves default process test to 0.9.
tests/​configs/​linux_process_abstract.json Moves abstract process test to 0.9.
tests/​configs/​bubblewrap_network_proxy_namespace.json Adopts the 0.9 proxy-only policy.
tests/​configs/​bubblewrap_network_proxy_egress_denied.json Tests 0.9 proxy egress confinement.
tests/​configs/​bubblewrap_network_proxy_connect.json Migrates CONNECT coverage to the 0.9 proxy form.
tests/​configs/​bubblewrap_network_proxy_builtin.json Rebases legacy proxy coverage to 0.7.
tests/​configs/​bubblewrap_network_proxy_blocklist.json Rebases legacy blocklist coverage to 0.7.
tests/​configs/​bubblewrap_network_proxy_allowlist.json Rebases legacy allowlist coverage to 0.7.
tests/​configs/​bubblewrap_network_firewall.json Rebases legacy firewall coverage to 0.7.
tests/​configs/​bubblewrap_network_firewall_cidr.json Ensures iptables resolution and detects false passes.
tests/​configs/​bubblewrap_network_block.json Rebases legacy network-block coverage to 0.7.
tests/​configs/​bubblewrap_filesystem.json Moves filesystem coverage to 0.9.
tests/​configs/​bubblewrap_basic.json Moves basic Bubblewrap coverage to 0.9.
src/​testing/​wxc_e2e_tests/​tests/​e2e_bubblewrap_characterization.rs Adds working-directory and missing-command characterization.
sdk/​node/​tests/​integration/​linux-bubblewrap.test.ts Adds Node integration coverage for 0.9 proxy behavior.
docs/​schema.md Documents Bubblewrap’s default working-directory behavior.
docs/​bwrap-support/​bubblewrap-backend.md Documents 0.9 proxy configuration and legacy behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/testing/wxc_e2e_tests/tests/e2e_bubblewrap_characterization.rs Outdated
Copilot AI review requested due to automatic review settings September 25, 2026 20:48

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.

Copilot review overview

🟡 Changes recommended

The new Rust test does not compile due to a missing import, and the deadline helper can still block indefinitely.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 2 Low severity

Open (4)
Resolved since last review (1)

Comment thread src/testing/wxc_e2e_tests/tests/e2e_bubblewrap_characterization.rs
Comment thread src/testing/wxc_e2e_tests/src/lib.rs Outdated
Comment thread docs/bwrap-support/bubblewrap-backend.md Outdated
Comment thread docs/schema.md Outdated
Copilot AI review requested due to automatic review settings September 25, 2026 21:01

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.

Copilot review overview

🟡 Changes recommended

Cleanup can signal reused PIDs, and the Node proxy tests do not gate on the complete host capability probe.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (4)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Use complete proxy network capability check before skipping tests

sdk/​node/​tests/​integration/​linux-bubblewrap.test.ts:215

This checks only that a slirp4netns path exists, but proxy-only startup also requires an executable slirp plus usable unshare, nsenter, iptables, and ip6tables. A host missing any of those passes this gate and fails both tests as an environmental error. Use the existing fail-closed getPlatformSupport().bubblewrapNetwork.proxyEnforcement capability result, which probes the complete dependency set, to decide whether to skip.

Comment thread tests/scripts/run_bwrap_network_proxy_test.sh
Copilot AI review requested due to automatic review settings September 25, 2026 21:17

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.

Copilot review overview

🔵 Needs a closer look

The Bubblewrap documentation incorrectly applies the loopback-only restriction to legacy hostname and routable proxy URLs.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Low severity Overstated loopback requirement for legacy proxy URLs

docs/​bwrap-support/​bubblewrap-backend.md:678

This loopback requirement is only true for runtimeConfig.networkProxy. Legacy network.proxy.url still accepts hostname/routable endpoints and pins them into the sandbox (the retained schema-0.8 hostname case in tests/scripts/run_bwrap_network_proxy_test.sh:400-475 exercises exactly that). As written, this now incorrectly tells 0.6–0.8 users that every external proxy must listen on loopback; scope the restriction to the directional field and preserve the legacy URL behavior.

Copilot AI review requested due to automatic review settings September 25, 2026 21:31

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.

Copilot review overview

🔵 Needs a closer look

The new schema documentation incorrectly presents default HOME behavior as unconditional despite explicit environment overrides.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Low severity Clarify HOME behavior with explicit process.env and cwd

docs/​schema.md:285

This overstates the HOME behavior. In 0.9, an explicit process.env with inheritDefaultEnv: false is used verbatim, so cwd does not necessarily become HOME; similarly, callers may explicitly set HOME even when cwd is absent. Describe this as the backend default rather than an unconditional result.

@theelliotm
Elliot (theelliotm) marked this pull request as ready for review September 25, 2026 22:49
@theelliotm
Elliot (theelliotm) requested a review from a team as a code owner September 25, 2026 22:49

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@theelliotm
Elliot (theelliotm) merged commit 8bc3d11 into main Sep 26, 2026
55 of 63 checks passed
@theelliotm
Elliot (theelliotm) deleted the user/emichlin/bwrap-testing-0.9 branch September 26, 2026 18:27
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.

Bubblewrap: RHEL test failure caused by "missing IP Tables Binary"

3 participants