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

Validate remote module names used by Save-Help by jshigetomi · Pull Request #28400 · PowerShell/PowerShell · GitHub

Repository navigation

Validate remote module names used by Save-Help - #28400

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

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

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
    • Added tests for the changed behavior

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 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) })
Justin Chung (jshigetomi) changed the title Protect Save-Help output paths by validating remote module names Validate remote module names before Save-Help constructs output paths Nov 11, 2026
Justin Chung (jshigetomi) changed the title Validate remote module names before Save-Help constructs output paths Validate remote module names used by Save-Help 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