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 — Apply implicit-remoting command protections to resolved aliases by jshigetomi · Pull Request #28208 · PowerShell/PowerShell

Conversation

@jshigetomi

@jshigetomi Justin Chung (jshigetomi) commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

PR Summary

This pull request improves the handling of command aliases and skip-list checks during implicit remoting in PowerShell, ensuring that commands on the server's skip-list cannot be imported via aliases unless explicitly allowed. It also adds new tests to cover these scenarios.

PR Context

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
@daxian-dbw Justin Chung
Fix the shadowing command bypass via alias for Import/Export-PSSession (
9a73903
#175)
@jshigetomi Justin Chung (jshigetomi) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 14, 2026
@azure-pipelines

azure-pipelines Bot commented Oct 14, 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.

@jshigetomi Justin Chung (jshigetomi) changed the title Fix the shadowing command bypass via alias for Import/Export-PSSession Apply implicit-remoting command restrictions to resolved aliases Oct 14, 2026
@jshigetomi
Merge branch 'master' into 175
3579e2d
@jshigetomi
Justin Chung (jshigetomi) marked this pull request as ready for review October 14, 2026 21:44
@jshigetomi
Justin Chung (jshigetomi) requested a review from a team as a code owner October 14, 2026 21:44
Copilot AI balanced review requested due to automatic review settings October 14, 2026 21:44
Copilot started reviewing on behalf of Justin Chung (jshigetomi) October 14, 2026 21:44
View session
Copilot AI reviewed Oct 14, 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

The corrected resolved-name safety check needs a regression test for an alias targeting an unsafe command name.

1 open finding
  • Medium severity Add regression test for aliases targeting unsafe command names · New
What changed in this PR

This PR applies implicit-remoting import safeguards to alias targets, preventing aliases from bypassing command restrictions.

Changes:

  • Validates resolved command names for safety.
  • Applies server skip-list and local clobber checks to alias targets.
  • Adds tests for restrictions and prefix-based imports.
File Description
test/​powershell/​Modules/​Microsoft.PowerShell.Utility/​Implicit.Remoting.Tests.ps1 Adds alias restriction tests and updates clobber handling.
src/​Microsoft.PowerShell.Commands.Utility/​commands/​utility/​ImplicitRemotingCommands.cs Applies import safeguards to resolved alias targets.

🧠 Review effort: Balanced


💡 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/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs
}

if (resolvedCommandName != null && !IsSafeNameOrIdentifier(commandMetadata.Name))
if (resolvedCommandName is not null && !IsSafeNameOrIdentifier(resolvedCommandName))
iSazonov
Ilya (iSazonov) reviewed Oct 15, 2026
View reviewed changes
Comment thread src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs
}

if (resolvedCommandName != null && !IsSafeNameOrIdentifier(commandMetadata.Name))
if (resolvedCommandName is not null && !IsSafeNameOrIdentifier(resolvedCommandName))

@iSazonov Ilya (iSazonov) Oct 15, 2026

Copy link
Copy Markdown
Collaborator

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.

Before the change IsSafeNameOrIdentifier was used only once and it threw if null or empty.
Now we always check for not null so we could do the check in IsSafeNameOrIdentifier.

Also here we don't check for empty but do the check below.

Should we move both checks to IsSafeNameOrIdentifier?

Sorry, something went wrong.

Uh oh!

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

All reactions
@iSazonov Ilya (iSazonov) mentioned this pull request Oct 15, 2026
Fix the shadowing command bypass via alias for Import/Export-PSSession #28217
Closed
12 tasks
@jshigetomi Justin Chung (jshigetomi) changed the title Apply implicit-remoting command restrictions to resolved aliases Apply implicit-remoting command protections to resolved aliases Oct 16, 2026
daxian-dbw
Dongbo Wang (daxian-dbw) approved these changes Oct 16, 2026
View reviewed changes
@jshigetomi
Justin Chung (jshigetomi) merged commit fbb4fd5 into master Oct 16, 2026
37 of 38 checks passed

Uh oh!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iSazonov Ilya (iSazonov) iSazonov left review comments
Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@daxian-dbw Dongbo Wang (daxian-dbw) daxian-dbw approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

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

@jshigetomi @daxian-dbw @iSazonov
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.