Repository navigation
Warn when Bubblewrap cwd is clearly unmounted - #1442
Open
Gudge (MGudgin) wants to merge 1 commit into
Open
Gudge (MGudgin) wants to merge 1 commit into
Gudge (MGudgin) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 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 on lines
+280
to
+284
| fn path_is_within(path: &str, parent: &str) -> bool { | ||
| parent == "/" && path.starts_with('/') | ||
| || path == parent | ||
| || (path.starts_with(parent) && path.as_bytes().get(parent.len()) == Some(&b'/')) | ||
| } |
This PR adds a conservative launch-time warning for an explicit, canonical process.cwd that is clearly outside Bubblewrap's mounts. It names the filesystem policy remedy while leaving ambiguous paths and execution results to Bubblewrap. Details * Compare cwd with the baseline, virtual, and policy mount destinations without rejecting the request. * Cover root mounts and every emitted mount destination in regression tests. * Verify the CLI warning on stderr alongside the original bwrap failure and document warning delivery for SDK and CLI callers. Tests * 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 shell syntax check: passed; live Linux bwrap test not run locally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6f448a40-019f-4bfd-82e0-ec6b7d23c4d8 Generated-with: gpt-6-sol
Gudge (MGudgin)
force-pushed
the
user/gudge/mxc_507_cwd_advisory
branch
from
October 7, 2026 17:19
85daae0 to
a284d8a
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds an advisory warning when an explicit, canonical
process.cwdis clearly outside Bubblewrap's mounts. It names the filesystem policy
remedy while leaving ambiguous paths and execution results to Bubblewrap.
Part of #507; the separate resolver-target diagnostic is #1441. This remains advisory as recommended when #1160 was closed. Neither PR alone closes #507.
Details
without rejecting the request.
and document SDK/CLI warning delivery.
Tests
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 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.C:\Program Files\Git\bin\bash.exe -n tests\scripts\run_bwrap_cwd_advisory_test.sh: passed.src/),CARGO_TARGET_DIR="$HOME/src/microsoft/mxc/mxc.root/src/target" cargo test -p mxc-sdk --lib bubblewrap::common --quiet -- --test-threads=1: 306 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; the uncovered cwd emitted the warning on stderr and retained Bubblewrap's error, while the covered cwd succeeded without the advisory.Microsoft Reviewers: Open in CodeFlow