Skip to content

[Bubblewrap] Keep host resolver sockets out of sandboxes - #1568

Open
Soham Das (SohamDas2021) wants to merge 2 commits into
mainfrom
sohamdas2021-bubblewrap-resolver-exposure
Open

Soham Das (SohamDas2021) wants to merge 2 commits into
mainfrom
sohamdas2021-bubblewrap-resolver-exposure

Conversation

@SohamDas2021

@SohamDas2021 Soham Das (SohamDas2021) commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

📖 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:

  • From src/: cargo test -q -p mxc-sdk --lib bubblewrap::common -- --test-threads=1 — 390 passed.
  • bash tests/scripts/run_bwrap_resolver_isolation_test.sh — 31 scenarios passed.
  • All 16 non-sudo Bubblewrap suites passed, run individually from the run_bwrap_all_tests.sh registry; five sudo/root-dependent suites were not run.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task

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 GitHub
Actions build; it runs on merge to main, and Microsoft reviewers with write access can trigger it
on a PR with /azp run. See pull request builds.

If the dependency-feed-check check fails on a new dependency, the crate must be added to
the feed before the PR can pass. See pull request builds
for the steps.

Microsoft Reviewers: Open in CodeFlow

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf
@SohamDas2021
Soham Das (SohamDas2021) requested a review from a team as a code owner October 23, 2026 20:17
Copilot AI balanced review requested due to automatic review settings October 23, 2026 20:17
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf

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.

🟡 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

Comment on lines +115 to +116
"--remount-ro".into(),
parent,
Copilot AI balanced review requested due to automatic review settings October 23, 2026 20:23

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.

🟡 Changes recommended

Recreated resolver symlinks can cause previously valid filesystem grants to abort sandbox startup.

2 open issues

Review effort: Balanced

Comment on lines +236 to +237
if link != destination {
args.extend(["--symlink".into(), destination, link]);

This branch has not been deployed

No deployments
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.

2 participants