Repository navigation
Validate remote module names used by Save-Help - #28400
Open
Justin Chung (jshigetomi) wants to merge 2 commits into
Open
Justin Chung (jshigetomi) wants to merge 2 commits into
Justin Chung (jshigetomi) wants to merge 2 commits into
Conversation
Justin Chung (jshigetomi)
requested review from
a team,
Aditya Patwardhan (adityapatwardhan) and
Dongbo Wang (daxian-dbw)
as code owners
November 11, 2026 19:12
|
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
The containment tests can pass without exercising file writes, and their path-prefix check can misclassify escaped files as inside the destination.
2 open issues
What changed in this PR
Hardens Save-Help output-path handling by validating remote module names before using them as path components.
Changes:
- Rejects empty names, path separators, Windows colons, and
.or... - Adds a localized error message for invalid module names.
- Adds tests for accepted and rejected names, platform-specific colon handling, and output containment.
| File | Description |
|---|---|
test/powershell/engine/Help/UpdatableHelpSystem.Tests.ps1 |
Adds remote module-name validation and output-containment checks. |
src/System.Management.Automation/resources/HelpDisplayStrings.resx |
Adds the invalid-module-name error message. |
src/System.Management.Automation/help/UpdatableHelpCommandBase.cs |
Validates module names before further help processing. |
Review effort: Balanced
| Guid = [guid]::NewGuid() | ||
| Version = [Version]'1.0.0.0' | ||
| ModuleBase = $root | ||
| HelpInfoUri = 'https://example.invalid/help/' |
| } | ||
|
|
||
| $escaped = @(Get-ChildItem -LiteralPath $root -Recurse -File -Force -ErrorAction SilentlyContinue | | ||
| Where-Object { -not $_.FullName.StartsWith($destFull, [System.StringComparison]::OrdinalIgnoreCase) }) |
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
PR Context
PR Checklist