Skip to content

Warn about unmatched Bubblewrap cwd mounts - #1442

Merged
Gudge (MGudgin) merged 1 commit into
mainfrom
user/gudge/mxc_507_cwd_advisory
Oct 9, 2026
Merged

Gudge (MGudgin) merged 1 commit into
mainfrom
user/gudge/mxc_507_cwd_advisory

Conversation

@MGudgin

@MGudgin Gudge (MGudgin) commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

This PR adds a conditional Bubblewrap hint when an explicit absolute
process.cwd has no apparent overlapping mount destination. It compares
path spellings without inspecting the host cwd or policy paths, and leaves
the actual --chdir result and execution behavior to Bubblewrap.

Part of #507; #1441 covers the resolver-target hint. Neither PR alone
closes #507. This remains advisory as recommended when #1160 was closed.

Details

  • Compare baseline, virtual, and policy mount destinations by components;
    unrelated policy grants do not suppress the hint.
  • Treat relative and ambiguous paths conservatively; symlink aliases can
    make a hint inapplicable without changing mounts or rejecting a request.
  • Check CLI stderr hints alongside Bubblewrap's own failure in the host
    test, including an unrelated policy mount and a covering mount.

Tests

  • From src/, cargo fmt --all -- --check: passed.
  • cargo check -p mxc-sdk --all-targets --quiet: passed.
  • cargo clippy -p mxc-sdk --all-targets --quiet -- -D warnings: passed.
  • cargo test -p mxc-sdk --lib bwrap_command --quiet: 56 passed on Windows.
  • cargo check -p mxc-sdk --target x86_64-unknown-linux-gnu --all-targets --quiet: passed.
  • cargo clippy -p mxc-sdk --target x86_64-unknown-linux-gnu --all-targets --quiet -- -D warnings: passed.
  • From repository root, C:\Program Files\Git\bin\bash.exe -n tests\scripts\run_bwrap_cwd_advisory_test.sh: passed.
  • Ubuntu 26.04 ARM64 WSL, from src/, CARGO_TARGET_DIR="$HOME/src/microsoft/mxc/mxc.root/src/target" cargo test -p mxc-sdk --lib bubblewrap::common --quiet -- --test-threads=1: 311 passed.
  • CARGO_TARGET_DIR="$HOME/src/microsoft/mxc/mxc.root/src/target" cargo build -p lxc --quiet: passed.
  • LXC_EXEC="$HOME/src/microsoft/mxc/mxc.root/src/target/debug/lxc-exec" bash ../tests/scripts/run_bwrap_cwd_advisory_test.sh: passed on the rebased tree, preserving both the cwd and resolver hints.
Microsoft Reviewers: Open in CodeFlow

Copilot AI balanced review requested due to automatic review settings October 7, 2026 17:06
@MGudgin
Gudge (MGudgin) requested a review from a team as a code owner October 7, 2026 17:06
@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.

🟡 Changes recommended

Raw string containment can incorrectly warn for equivalent mount paths containing repeated or trailing separators.

1 open finding
What changed in this PR

Adds conservative Bubblewrap warnings when an explicit working directory is clearly outside mounted paths.

Changes:

  • Detects uncovered canonical working directories and retains warnings.
  • Adds unit and CLI integration coverage.
  • Documents warning behavior and remedies.
File Description
bwrap_runner.rs Emits and tests retained cwd warnings.
bwrap_command.rs Determines whether cwd overlaps known mounts.
run_bwrap_cwd_advisory_test.sh Tests CLI warning and execution behavior.
run_bwrap_all_tests.sh Registers the new integration test.
bubblewrap-backend.md Documents the advisory.

🧠 Review effort: Balanced


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

Comment thread src/mxc-sdk/src/backends/bubblewrap/common/bwrap_command.rs
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/mxc_507_cwd_advisory branch from 85daae0 to a284d8a Compare October 7, 2026 17:19
@MGudgin Gudge (MGudgin) changed the title feat(bwrap): warn on clearly uncovered working directories Warn when Bubblewrap cwd is clearly unmounted Oct 7, 2026
Copilot AI balanced review requested due to automatic review settings October 7, 2026 21:55

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.

🟢 Approval recommended

The advisory remains conservative, preserves Bubblewrap behavior, and has focused regression and integration coverage.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 20:07
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/mxc_507_cwd_advisory branch from 3201984 to 9f9f9dc Compare October 8, 2026 20:07
@MGudgin Gudge (MGudgin) changed the title Warn when Bubblewrap cwd is clearly unmounted Warn about unmatched Bubblewrap cwd mounts Oct 8, 2026

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.

🟢 Approval recommended

The advisory remains conservative, preserves Bubblewrap behavior, and has focused unit and host-test coverage.

0 open findings

🧠 Review effort: Balanced

This PR adds a conditional launch-time hint when an explicit absolute
process.cwd has no overlapping known mount destination. It compares path
spellings without canonicalizing host or policy paths, and leaves the
actual --chdir result to Bubblewrap.

Details

* Compare baseline, virtual, and policy mount destinations by components.
* Keep uncertain paths advisory-only and retain the hint for SDK callers
  and on lxc-exec stderr.
* Cover unrelated and covering policy mounts without changing execution.

Tests

* From src/, cargo fmt --all -- --check: passed.
* cargo check -p mxc-sdk --all-targets --quiet: passed.
* cargo clippy -p mxc-sdk --all-targets --quiet -- -D warnings: passed.
* cargo test -p mxc-sdk --lib bwrap_command --quiet: 53 passed.
* Linux-target mxc-sdk all-target check and Clippy: passed.
* Git Bash cwd shell test syntax check: passed.
* Native Linux Bubblewrap test not run: WSL command execution hung.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6f448a40-019f-4bfd-82e0-ec6b7d23c4d8
Generated-with: gpt-6-sol
Copilot AI balanced review requested due to automatic review settings October 9, 2026 03:26
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/mxc_507_cwd_advisory branch from 9f9f9dc to e38ce02 Compare October 9, 2026 03:26

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.

🟢 Approval recommended

The advisory preserves Bubblewrap behavior and is covered across detection, warning retention, and host execution.

0 open findings

🧠 Review effort: Balanced

@MGudgin
Gudge (MGudgin) merged commit a0b66e6 into main Oct 9, 2026
31 checks passed
@MGudgin
Gudge (MGudgin) deleted the user/gudge/mxc_507_cwd_advisory branch October 9, 2026 04:07
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.

feat(bwrap): Improve error reporting for deny by default file system semantics

3 participants