Skip to content

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

Merged
Soham Das (SohamDas2021) merged 5 commits into
mainfrom
sohamdas2021-bubblewrap-resolver-exposure
Oct 27, 2026
Merged

Soham Das (SohamDas2021) merged 5 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 — 391 passed.
  • bash tests/scripts/run_bwrap_resolver_isolation_test.sh — 36 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

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf
Copilot AI balanced review requested due to automatic review settings October 26, 2026 21:20

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.

🔵 Needs a closer look

Security-sensitive mount translation has unresolved filesystem-policy defects and requires human review with host-level validation.

2 open issues
2 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b6bf5b15-f491-41eb-859b-482d099f51cf
Copilot AI balanced review requested due to automatic review settings October 26, 2026 21:50

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

Automatic DNS pinning can overwrite an explicitly writable resolver granted through a symlink alias.

3 open issues

Review effort: Balanced

const SECCOMP_DATA_ARG0_LOW_OFFSET: u32 = 16;

#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", test))]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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
Copilot AI balanced review requested due to automatic review settings October 27, 2026 18:18

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.

🔵 Needs a closer look

Security-sensitive symlink reconstruction and filesystem mount ordering warrant final human verification beyond the reported WSL validation.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

@SohamDas2021
Soham Das (SohamDas2021) merged commit 6a0a00e into main Oct 27, 2026
31 checks passed
@SohamDas2021
Soham Das (SohamDas2021) deleted the sohamdas2021-bubblewrap-resolver-exposure branch October 27, 2026 22:23
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.

4 participants