Repository navigation
Enable usage in AppContainers - #27266
Justin Chung (jshigetomi) merged 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR aims to prevent failures when validating or discovering fixed drives and user module paths in restricted environments (e.g., AppContainers), where direct access to certain roots/special folders may be denied.
Changes:
- Replace direct fixed-drive existence checks with a helper that tolerates access-denied scenarios.
- Update default drive initialization to use the new fixed-drive validator.
- Avoid verification when retrieving the “My Documents” special folder path on Windows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/System.Management.Automation/namespaces/FileSystemProvider.cs |
Introduces IsValidFixedDrive and routes fixed-drive validation through it to avoid access-related failures. |
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs |
Uses Environment.SpecialFolderOption.DoNotVerify when reading MyDocuments to avoid verification failures. |
|
Sandboxing ps in AppContainers (which is actually lightweight and pretty fancy way of isolation in win environment) is actually nearly impossible regarding any cmd that one way or another linked to file system manipulation. Guys approve ASAP, please! I'm sure a lot of people will be thankful. |
Co-authored-by: Patrick Meinecke <SeeminglyScience@users.noreply.github.com>
Co-authored-by: Patrick Meinecke <SeeminglyScience@users.noreply.github.com>
Co-authored-by: Patrick Meinecke <SeeminglyScience@users.noreply.github.com>
2475feb
into
PowerShell:master
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
|
Patrick Meinecke (@SeeminglyScience), a follow-up on the scope of this AppContainer fix: #28268 reports a separate Win32Exception during optional network-drive display-root discovery. What regression checks would you require for handling that exception while preserving filesystem access denials and completing unrelated drive initialization? Is there a maintainer-tracked fix or released version for that remaining path? I am asking about supported upstream handling, not replacing a vendor-bundled binary. |
PR Summary
Fixes #27253
PR Context
By default in AppContainers, the root of the system drive is not accessible. When PowerShell sees this during initialization, it assumes that the entire drive is not accessible and treats it as not being present (and therefore also stops loading pretty much everything else). This change will allow PowerShell to treat "access denied" as evidence that the drive does exist.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header