[WSLC] Reject UNC paths in WSLC filesystem policy#537
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the WSLC backend’s filesystem policy handling by failing fast when readwritePaths / readonlyPaths contain non-drive-letter Windows paths (e.g., UNC paths), avoiding silent “mount skipped” misconfiguration before the container starts.
Changes:
- Changed
policy_mapping::build_volume_mounts()to returnResultand to hard-error on any non-drive-letter path. - Updated the WSLC runner to treat mount-building failures as execution errors (instead of logging warnings and continuing).
- Updated unit tests to assert rejection behavior for UNC and other invalid paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/backends/wslc/common/src/wsl_container_runner.rs | Converts mount-building failures into an early ScriptResponse::error before container creation. |
| src/backends/wslc/common/src/policy_mapping.rs | Implements strict validation (drive-letter only) for volume mounts and updates unit tests accordingly. |
Comment on lines
65
to
67
| /// - `readwrite_paths` → mounts with `read_only: false` | ||
| /// - `readonly_paths` → mounts with `read_only: true` | ||
| /// - `denied_paths` → not mounted (Linux container isolation means they're inaccessible) |
e5155a0 to
a1b0e4a
Compare
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.
📖 Description
The WSLC backend can only mount drive-letter paths (translated to
/mnt/<drive>/); UNC paths (\\server\share,\\wsl$\...,\\?\...) have no mapping mechanism in the WSLC SDK. Previously these were silently skipped with a warning log, risking silent misconfiguration where users believe a path is mounted but it isn't.This change makes
build_volume_mounts()return a hard error for any path that isn't a valid drive-letter path, failing execution before the container starts with a clear message identifying the offending path.🔗 References
🔍 Validation
✅ Checklist
📋 Issue Type
GitHub Actions runs the PR validation build automatically. The ADO pipeline
(
MXC-PR-Build) is the official build pipeline that signs the binaries; itruns on merge to
mainand nightly, and Microsoft reviewers can trigger iton a PR with
/azp run. See docs/pull-requests.md.Microsoft Reviewers: Open in CodeFlow