Skip to content

bwrap: Add the option to skip the procfs mount - #1508

Open
Wes Turner (westurner) wants to merge 2 commits into
microsoft:mainfrom
westurner:add-no_procfs-option
Open

Wes Turner (westurner) wants to merge 2 commits into
microsoft:mainfrom
westurner:add-no_procfs-option

Conversation

@westurner

@westurner Wes Turner (westurner) commented Oct 15, 2026 •

Copy link
Copy Markdown

📖 Description

🔗 References

🔍 Validation

  • cargo test
  • cargo fuzz

✅ 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

Add additive SDK entrypoints for omitting or explicitly mounting procfs without changing the historical behavior of existing spawn and run APIs. Keep the private PID namespace in no-proc mode and remove the proc mount only from Bubblewrap options before the command separator.

Reserve the internal procfs control variable so external process environments cannot select or spoof the SDK policy, and strip the marker before the child environment is constructed. Document the compatibility contract and cover policy mapping, legacy behavior, explicit mount/omit, and malformed Bubblewrap command handling.
Add a cargo-fuzz target for external MXC JSON requests that asserts successful parsing never retains the reserved internal procfs environment marker. Seed ordinary requests and marker values for omission, mounting, and invalid input. The target parses only and never launches a sandbox process.

A bounded Linux campaign completed 2,276,062 executions in 31 seconds without a crash.
Copilot AI balanced review requested due to automatic review settings October 15, 2026 19:36
@westurner
Wes Turner (westurner) requested a review from a team as a code owner October 15, 2026 19:36

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

Policy enforcement, internal-control isolation, policy identity, and fuzz-input handling need correction.

4 open findings
What changed in this PR

Adds optional procfs mounting to Rust V1 Bubblewrap execution, addressing #1507 while preserving existing entrypoint behavior.

Changes:

  • Adds explicit procfs policies and execution entrypoints.
  • Conditionally mounts /proc and protects the internal environment control.
  • Adds unit tests, a fuzz target, and migration documentation.
File Description
src/​testing/​fuzz/​fuzz_targets/​procfs_policy.rs Adds reserved-variable boundary fuzzing.
src/​testing/​fuzz/​corpus/​procfs_policy/​valid.json Seeds ordinary environment input.
src/​testing/​fuzz/​corpus/​procfs_policy/​unknown-value.json Seeds an unknown control value.
src/​testing/​fuzz/​corpus/​procfs_policy/​omit.json Seeds the omit control value.
src/​testing/​fuzz/​corpus/​procfs_policy/​mount.json Seeds the mount control value.
src/​testing/​fuzz/​Cargo.toml Registers the fuzz target.
src/​testing/​fuzz/​.gitignore Keeps curated JSON seeds tracked.
src/​mxc-sdk/​src/​policy.rs Prepares procfs controls and adds tests.
src/​mxc-sdk/​src/​options.rs Defines ProcfsPolicy.
src/​mxc-sdk/​src/​lib.rs Exposes explicit-policy execution APIs.
src/​mxc-sdk/​src/​core/​mxc_common/​models.rs Defines the internal control name.
src/​mxc-sdk/​src/​core/​mxc_common/​config_parser.rs Rejects external reserved-variable input.
src/​mxc-sdk/​src/​backends/​bubblewrap/​common/​bwrap_command.rs Conditionally mounts procfs and strips the control.
docs/​backends/​bwrap/​bubblewrap-backend.md Documents policy choices, migration, and fuzzing.

🧠 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/policy.rs
prepared.inner.env = request.environment.as_ref().map(|environment| {
environment
.iter()
.filter(|(key, _)| key != crate::mxc_common::models::INTERNAL_MOUNT_PROCFS_ENV)
Comment thread src/mxc-sdk/src/policy.rs
Comment on lines +890 to +895
if cfg!(target_os = "linux")
&& matches!(
request.containment,
Containment::Process | Containment::Bubblewrap
)
{
Comment thread src/mxc-sdk/src/policy.rs
Comment on lines +903 to +907
.get_or_insert_with(Vec::new)
.push(format!(
"{}={procfs_control}",
crate::mxc_common::models::INTERNAL_MOUNT_PROCFS_ENV
));
Comment on lines +11 to +22
use mxc_sdk::mxc_common::config_parser::load_mxc_request;
use mxc_sdk::mxc_common::logger::{Logger, Mode};
use mxc_sdk::mxc_common::state_aware_request::MxcRequest;

const RESERVED_PROCFS_ENV: &str = "MXC_INTERNAL_MOUNT_PROCFS";

fuzz_target!(|data: &[u8]| {
let Ok(json) = std::str::from_utf8(data) else {
return;
};
let mut logger = Logger::new(Mode::Buffer);
if let Ok(MxcRequest::OneShot(request)) = load_mxc_request(json, &mut logger, false) {

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