FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Validate remote module names before Import-Module by jshigetomi · Pull Request #28401 · PowerShell/PowerShell · GitHub

Repository navigation

Validate remote module names before Import-Module - #28401

Open
Justin Chung (jshigetomi) wants to merge 1 commit into
PowerShell:masterfrom
jshigetomi:242bp
Open

Justin Chung (jshigetomi) wants to merge 1 commit into
PowerShell:masterfrom
jshigetomi:242bp

Conversation

Justin Chung (jshigetomi) commented Nov 11, 2026 •
edited
Loading

Copy link
Copy Markdown
Collaborator

PR Summary

PR Context

PR Checklist

  • PR has a meaningful title
  • Summarized changes
  • Existing files retain their copyright headers
  • This PR is ready to merge
  • Breaking changes
    • None
  • User-facing changes
    • Not Applicable
  • Testing - New and feature
    • N/A or can only be tested interactively

Justin Chung (jshigetomi) requested a review from a team as a code owner November 11, 2026 19:12
Copilot AI balanced review requested due to automatic review settings November 11, 2026 19:12

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

Justin Chung (jshigetomi) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 11, 2026

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

🟡 Changes recommended

The new module-name validation lacks regression coverage for invalid names and platform-specific handling, leaving its error behavior and prevention of local proxy-file creation unverified.

1 open issue What changed in this PR

Adds protective validation before Import-Module -PSSession uses remote module names to construct local proxy-module paths.

Changes:

  • Rejects null/empty names, path separators, ./.., and colons on Windows.
  • Reports an error and skips rejected modules before constructing local paths.
File Description
src/​System.Management.Automation/​resources/​Modules.resx Adds the error message for rejected module names.
src/​System.Management.Automation/​engine/​Modules/​ImportModuleCommand.cs Validates remote module names before local path construction.

Review effort: Balanced

Version remoteModuleVersion,
PSSession psSession)
{
if (string.IsNullOrEmpty(remoteModuleName) || remoteModuleName.IndexOfAny(s_pathTraversalChars) >= 0 || remoteModuleName is "." or "..")
Justin Chung (jshigetomi) changed the title Protect remote module import paths by validating module names Validate remote module names before Import-Module constructs local paths Nov 11, 2026
Justin Chung (jshigetomi) changed the title Validate remote module names before Import-Module constructs local paths Validate remote module names before Import-Module Nov 11, 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

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL