Repository navigation
[Bubblewrap] Prevent workloads after failed network setup - #1716
Soham Das (SohamDas2021) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🔵 Needs a closer look
Containment-sensitive startup and process-group cleanup changes need maintainer confirmation and broader Linux validation because runtime evidence is WSL2-only and Linux CI remains pending.
No open issues 🎉
What changed in this PR
Fixes #1636 by keeping Bubblewrap workloads blocked when network-rule installation fails, restoring fail-closed startup behavior without changing public APIs or request formats.
Changes:
- Terminates the sandbox process group before releasing the startup barrier and preserves the launcher for cleanup.
- Adds regression coverage for proxy-only and firewall-enforced failures through SDK
run,spawn, andspawn_with_pty. - Documents startup cleanup guarantees and validation coverage.
| File | Description |
|---|---|
src/mxc-sdk/tests/streaming_bubblewrap.rs |
Tests setup errors, absence of workload writes, and descendant cleanup across six combinations. |
src/mxc-sdk/src/backends/bubblewrap/common/proxy_network.rs |
Preserves startup-barrier ownership and avoids prematurely reaping the launcher. |
src/mxc-sdk/src/backends/bubblewrap/common/bwrap_runner.rs |
Kills the startup process group before dropping the barrier and reports cleanup errors. |
docs/development/build-and-test/ci-validation-infrastructure.md |
Describes CLI and SDK startup-failure coverage. |
docs/backends/bwrap/bubblewrap-backend.md |
Documents fail-closed startup and helper cleanup behavior. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Startup-barrier and process-group changes affect sandbox containment, requiring confirmation of strict Linux CI and namespace-startup validation on supported distributions because runtime validation was unavailable during review.
No open issues 🎉
Review effort: Balanced
📖 Description
Prevents Bubblewrap workloads from running when network-rule installation fails. Startup failures now terminate the blocked sandbox and clean up its helpers before returning the original error.
Adds regression coverage for proxy-only and firewall-enforced networking through SDK
run,spawn, andspawn_with_pty. The existing CLI failure-path assertion remains unchanged.No design spec is required: this restores documented failure behavior without changing public APIs, request formats, or supported policy.
🔗 References
Fixes #1636.
🔍 Validation
Validated on WSL2 with Bubblewrap 0.9.0 and strict prerequisite checks enabled.
The existing CLI regression reproduced
WORKLOAD_STARTEDbefore the fix and passes unchanged afterward. The SDK regression checks the original error, absence of workload file writes, and descendant cleanup across all six network-mode/API combinations.Commands run from
src/:cargo test --locked --quiet -p mxc-sdk --lib backend_modules::bubblewrap::common::proxy_network::cargo test --locked --quiet -p mxc-sdk --lib backend_modules::bubblewrap::common::bwrap_runner::cargo test --locked --quiet -p mxc-sdk --test streaming_bubblewrapcargo test --locked --release --quiet -p mxc-sdk --test streaming_bubblewrapcargo clippy --locked --quiet -p mxc-sdk --lib --test streaming_bubblewrap -- -D warningscargo fmt --all -- --checkFrom the repository root, with
LXC_EXECpointing to the release executable:timeout 90 bash tests/scripts/run_bwrap_namespace_startup_test.sh— passed three consecutive runs.Remote CI and other Linux distributions were not run.
✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow