GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Validate remote module names before Import-Module by jshigetomi · Pull Request #28401 · PowerShell/PowerShell Conversation
|
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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.
Adds protective validation before Import-Module -PSSession uses remote module names to construct local proxy-module paths.
Changes:
./.., and colons on Windows.| 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| Version remoteModuleVersion, | ||
| PSSession psSession) | ||
| { | ||
| if (string.IsNullOrEmpty(remoteModuleName) || remoteModuleName.IndexOfAny(s_pathTraversalChars) >= 0 || remoteModuleName is "." or "..") |
| ['\\', '/']; | ||
| #else | ||
| ['\\', '/', ':']; | ||
| #endif |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You could use specific API like ContainsAny()
https://source.dot.net/#System.Private.CoreLib/src/runtime/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs,479
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.