GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Protect the fallback temporary home directory by enforcing and checking its file mode on Unix platforms by daxian-dbw · Pull Request #27985 · PowerShell/PowerShell

Conversation

@daxian-dbw

@daxian-dbw Dongbo Wang (daxian-dbw) commented Sep 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge. If this PR is a work in progress, please open this as a Draft Pull Request and mark it as Ready to Review when it is ready to merge.
  • Breaking changes
    • None
    • OR
    • Experimental feature(s) needed
      • Experimental feature name(s):
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI lite review requested due to automatic review settings September 8, 2026 17:33
@daxian-dbw
Dongbo Wang (daxian-dbw) requested a review from a team as a code owner September 8, 2026 17:33
@azure-pipelines

azure-pipelines Bot commented Sep 8, 2026

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of Dongbo Wang (daxian-dbw) September 8, 2026 17:33
View session
Copilot AI reviewed Sep 8, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 HOME directory 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/System.Management.Automation/CoreCLR/CorePsPlatform.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/System.Management.Automation/resources/CoreClrStubResources.resx Resolved

Uh oh!

There was an error while loading. Please reload this page.

daxian-dbw
Dongbo Wang (daxian-dbw) commented Sep 8, 2026
View reviewed changes
Comment thread src/System.Management.Automation/CoreCLR/CorePsPlatform.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Sep 8, 2026
iSazonov
Ilya (iSazonov) approved these changes Sep 9, 2026
View reviewed changes
@daxian-dbw
Guard the home fallback directory
5a4e640
@daxian-dbw
Dongbo Wang (daxian-dbw) force-pushed the msrc-home-fallback branch from 70b55d6 to 5a4e640 Compare September 9, 2026 16:18
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Rebased and force-pushed the branch to fix CIs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw Dongbo Wang (daxian-dbw) changed the title Prevent the fallback temporary home directory from being tampered Protect the fallback temporary home directory by enforcing and checking its file mode on Unix platforms Sep 16, 2026
SeeminglyScience
Patrick Meinecke (SeeminglyScience) approved these changes Sep 22, 2026
View reviewed changes
@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 154bbe8 into PowerShell:master Sep 22, 2026
38 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw
Dongbo Wang (daxian-dbw) deleted the msrc-home-fallback branch September 22, 2026 19:36
@daxian-dbw Dongbo Wang (daxian-dbw) added the Backport-7.7.x-Consider label Sep 22, 2026
@daxian-dbw Dongbo Wang (daxian-dbw) added Backport-7.7.x-Done and removed Backport-7.7.x-Consider labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@iSazonov Ilya (iSazonov) iSazonov approved these changes
@SeeminglyScience Patrick Meinecke (SeeminglyScience) SeeminglyScience approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Backport-7.7.x-Done CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@daxian-dbw @iSazonov @SeeminglyScience
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.