Repository navigation
Protect the fallback temporary home directory by enforcing and checking its file mode on Unix platforms - #27985
Merged
Dongbo Wang (daxian-dbw) merged 1 commit intoSep 22, 2026
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
A newly introduced user-facing error message is potentially misleading about the condition being detected, and should be adjusted for accuracy before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR hardens PowerShell startup on Unix when HOME is not set by creating (and validating) a fallback temporary home directory with user-only permissions, and failing fast if that directory appears unsafe.
Changes:
- Create the fallback temp
HOMEdirectory with explicit user-only Unix permissions (0700) and validate the resulting mode. - Add a localized error message for the unsafe-permission startup failure case.
File summaries
| File | Description |
|---|---|
| src/System.Management.Automation/CoreCLR/CorePsPlatform.cs | Creates temp HOME with explicit UnixFileMode and throws on unexpected permissions. |
| src/System.Management.Automation/resources/CoreClrStubResources.resx | Adds a new resource string for the unsafe temp HOME permission startup error. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Ilya (iSazonov)
approved these changes
Sep 9, 2026
Dongbo Wang (daxian-dbw)
force-pushed
the
msrc-home-fallback
branch
from
September 9, 2026 16:18
70b55d6 to
5a4e640
Compare
Member
Author
|
Rebased and force-pushed the branch to fix CIs. |
Patrick Meinecke (SeeminglyScience)
approved these changes
Sep 22, 2026
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.
PR Summary
Protect the home fallback directory by checking its Unix permission mode -- PowerShell always creates the temporary home directory with the user-only permission, so if its mode is not what we expect, then it indicates the directory may be tampered (e.g. a different local user created it) and we fail the startup for security reason.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header