Repository navigation
[Bubblewrap] Keep host resolver sockets out of sandboxes - #1568
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf
There was a problem hiding this comment.
🟡 Changes recommended
The resolver directory becomes read-only before sibling policy mount points can be created, causing valid sandbox launches to fail.
1 open issue
What changed in this PR
This PR hardens Bubblewrap’s resolver setup against DNS egress-policy bypasses through host Unix sockets, while retaining the DNS forwarding introduced in #1453.
Changes:
- Replaces automatic resolver-directory mounts with sealed, read-only resolver snapshots and required symlink layouts.
- Integrates snapshot descriptors with sandbox startup and filesystem-policy ordering.
- Adds resolver isolation coverage, Linux CI checks, and backend documentation.
| File | Description |
|---|---|
tests/scripts/run_bwrap_resolver_isolation_test.sh |
Adds resolver isolation and filesystem-policy scenarios. |
tests/scripts/run_bwrap_all_tests.sh |
Registers the resolver isolation suite. |
src/mxc-sdk/src/backends/bubblewrap/common/seccomp_filter.rs |
Reuses the shared descriptor relocation helper. |
src/mxc-sdk/src/backends/bubblewrap/common/resolver_file.rs |
Prepares sealed resolver snapshots and symlink layouts. |
src/mxc-sdk/src/backends/bubblewrap/common/proxy_network.rs |
Shares descriptor handling and updates resolver denial checks. |
src/mxc-sdk/src/backends/bubblewrap/common/mod.rs |
Registers the Linux-only resolver module. |
src/mxc-sdk/src/backends/bubblewrap/common/bwrap_runner.rs |
Integrates resolver mounts and descriptor inheritance. |
src/mxc-sdk/src/backends/bubblewrap/common/bwrap_command.rs |
Removes resolver-directory baseline mounts and accepts snapshot arguments. |
docs/development/build-and-test/ci-validation-infrastructure.md |
Documents resolver validation coverage. |
docs/backends/bwrap/bubblewrap-backend.md |
Explains resolver snapshots, socket isolation, and limitations. |
.github/workflows/Build.Linux.Job.yml |
Adds resolver unit tests to Linux validation. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf
| const SECCOMP_DATA_ARG0_LOW_OFFSET: u32 = 16; | ||
|
|
||
| #[cfg(target_os = "linux")] | ||
| #[cfg(all(target_os = "linux", test))] |
There was a problem hiding this comment.
question: does moving this to test affect anything? is it to catch a regression that this change fixes? Just wondering why test here but not before.
There was a problem hiding this comment.
The FD-relocation code moved to the shared helper, leaving this constant used only by the existing unit test. cfg(test) just avoids an unused-constant warning in normal builds; it isn’t adding a new regression check.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf


📖 Description
Stop automatically exposing host resolver Unix sockets to Bubblewrap sandboxes, closing a DNS egress-policy bypass. Expose only read-only resolver configuration while preserving DNS forwarding, symlink layouts, and filesystem-policy overrides.
🔗 References
Related: #1453.
🔍 Validation
Ubuntu WSL:
src/:cargo test -q -p mxc-sdk --lib bubblewrap::common -- --test-threads=1— 391 passed.bash tests/scripts/run_bwrap_resolver_isolation_test.sh— 36 scenarios passed.run_bwrap_all_tests.shregistry; five sudo/root-dependent suites were not run.✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 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 pull request builds.If the
dependency-feed-checkcheck fails on a new dependency, the crate must be added tothe feed before the PR can pass. See pull request builds
for the steps.
Microsoft Reviewers: Open in CodeFlow