Skip to content

Reject relative ProcessContainer filesystem policy paths - #1695

Open
Safet Hrbinic (safmswork) wants to merge 3 commits into
mainfrom
fix/processcontainer-absolute-policy-paths
Open

Safet Hrbinic (safmswork) wants to merge 3 commits into
mainfrom
fix/processcontainer-absolute-policy-paths

Conversation

@safmswork

@safmswork Safet Hrbinic (safmswork) commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Validate all four filesystem policy lists before backend availability checks or native launch, including direct dry-run validation. Add regression-first backend and public SDK coverage, scheduled native controls, and compatibility documentation.

📖 Description

Currently if we configure filesystem access as:
Allow: c:\foo
Deny: bar.txt

Because bar.txt is a relative path and there is no way to know exactly which bar.txt on the device is meant here, the results are undefined. I ran a test on Windows and it actually allows access to c:\foo\bar.txt .

So let's require fully qualified Windows paths in ProcessContainer's read/write,
read-only, denied, and enumeration-only filesystem policy lists. Reject
unresolved paths before host capability checks and native creation, including
direct backend validation and dry runs. Return a path-specific policy validation
error instead of resolving entries against the launcher or workload directory.

Keep the validation in the ProcessContainer backend. Other backends, published
SDK API shapes, released schemas, and existing absolute-path handling are
unchanged. This is a security-servicing validation fix, not a new feature or API;
no separate feature/API design spec is required. Document the compatibility
exception and caller requirements.

Add backend and public Rust SDK regressions, plus scheduled native policy-suite
coverage with host-readable and absolute-deny controls.

🔗 References

🔍 Validation

✅ Checklist

  • Signed the Contributor License Agreement
  • Linked to an issue
  • For features or changes requiring a spec: linked the issue with maintainer-applied feature-accepted
  • For implementation: linked the required approved and merged design/API spec, or explained why no spec is required
  • Feature issue remains open unless this PR completes all agreed implementation, validation, and documentation
  • Updated documentation (if applicable)
  • Updated Copilot instructions (if build, architecture, or conventions changed)
  • If this PR changes Cargo.lock, the dependency-feed-check check passes (see pull request builds)

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

Validate all four filesystem policy lists before backend availability checks or native launch, including direct dry-run validation. Add regression-first backend and public SDK coverage, scheduled native controls, and compatibility documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 893f07dd-e993-4211-9514-19f718c8eb8f
@safmswork
Safet Hrbinic (safmswork) requested a review from a team as a code owner November 6, 2026 08:02
Copilot AI balanced review requested due to automatic review settings November 6, 2026 08:02
@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

The V1 path-validation behavior change needs an explicit maintainer compatibility decision, and validation diagnostics can point callers to the wrong entry after list normalization.

2 open issues
What changed in this PR

This PR tightens ProcessContainer filesystem policy validation within the backend, rejecting relative paths before capability checks or native launch while leaving other backends unchanged.

Changes:

  • Validate all four filesystem policy lists, including direct dry-run validation.
  • Add backend, public Rust SDK, and native policy-suite regression coverage with readable-file and absolute-deny controls.
  • Document caller requirements and the V1 security-servicing compatibility exception.
File Description
tests/​scripts/​run_processcontainer_policy_tests.ps1 Adds native controls and relative-path rejection cases.
tests/​scripts/​lib/​processcontainer_policy_probe.ps1 Adds file-read and denied-access assertions.
src/​mxc-sdk/​tests/​streaming_processcontainer.rs Tests public run/spawn rejection before workload execution.
src/​mxc-sdk/​src/​backends/​process_container/​common/​probe.rs Adapts probe diagnostics to owned rejection messages.
src/​mxc-sdk/​src/​backends/​process_container/​common/​base_container_runner.rs Adds path validation, policy errors, and backend regressions.
docs/​schema.md Documents fully qualified filesystem path requirements.
docs/​development/​guides/​process-container-adding-os-features.md Explains backend validation ordering.
docs/​development/​build-and-test/​ci-validation-infrastructure.md Describes native policy-suite regression scenarios.
docs/​development/​architecture/​versioning.md Records the security-servicing compatibility exception.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 13, 2026 22:30

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

The change breaks published V1 ProcessContainer compatibility without an explicit maintainer decision or versioned surface, and its validation diagnostics can identify the wrong caller path.

2 open issues

Review effort: Balanced

Comment on lines +85 to +90
ProcessContainer validates that filesystem policy paths are fully qualified
before checking host capabilities or creating a PSEC environment. The direct
backend validation path applies the same check, including dry runs. Do not
resolve relative policy paths against the launcher or workload directory.
See [filesystem policy](../../schema.md#filesystem-policy) for the caller-facing
requirements.

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.

issue: this file is for telling folks how to add an os feature for mxc and then expose it through MXC. Not rreally the place to put this information. Tbh this seems more like it would be in a code coment.

Self::Serviceable => return None,
Self::InvalidFilesystemPath { field, index } => {
return Some(format!(
"{field}[{index}] must be a fully qualified Windows filesystem path; \

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: how would {field}[{index}] appear in the error text? I'm mostlly asking about the index, since I wonder what the value would refer too. My thinking would be that we should actually print the path rather than the index so the user actually knows.

// PSEC policy paths have no working-directory base. In particular,
// a relative deny must not silently leave a broader grant in effect.
if let Some(index) = paths.iter().position(|path| !Path::new(path).is_absolute()) {
return Some(BaseContainerRequestDecision::InvalidFilesystemPath { field, index });

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.

note: would be preferrable for user diagnostics to return the path themselves tbh rather than the index.

Report escaped offending paths instead of normalized list indices, add overlap regression coverage, and move servicing notes into SDK changelogs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 893f07dd-e993-4211-9514-19f718c8eb8f
Copilot AI balanced review requested due to automatic review settings November 19, 2026 08:42

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

This security-sensitive Windows containment change requires native PSEC validation of readable-file, absolute-deny, and relative-path rejection controls, whose runtime results were unavailable during static review.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

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.

3 participants