Skip to content

Improve remote prompt handling for PSCredential and SecureString arrays - #28007

Merged
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
anamnavi:remote-prompt-validation
Sep 11, 2026
Merged

Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
anamnavi:remote-prompt-validation

Conversation

@anamnavi

@anamnavi Anam Navied (anamnavi) commented Sep 11, 2026

Copy link
Copy Markdown
Member

PR Summary

This pull request improves handling of PSCredential and SecureString types in PowerShell remoting, including cases where these types are used in arrays or specified with assembly-qualified names. The changes ensure these types are consistently recognized and processed across a wider range of remoting scenarios

PR Context

PR Checklist

Copilot AI lite review requested due to automatic review settings September 11, 2026 17:24
@azure-pipelines

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

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.

🟡 Changes recommended

Nested array types can bypass the intended remote prompt protections.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Improves remoting prompt handling for PSCredential and SecureString arrays and qualified type names.

Changes:

  • Adds sensitive-type checks for arrays.
  • Normalizes array and assembly-qualified type names.
  • Nested arrays still need consistent recursive handling.
File summaries
File Summary
src/System.Management.Automation/engine/remoting/common/WireDataFormat/RemoteHost.cs Adds array-aware security checks; jagged arrays require further handling.
src/System.Management.Automation/engine/hostifaces/InternalHostUserInterface.cs Recognizes normalized sensitive type names.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@TravisEz13 Travis Plunk (TravisEz13) added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Sep 11, 2026
@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit a71ba38 into PowerShell:master Sep 11, 2026
36 of 37 checks passed
{
if (typeName.Equals(nameof(PSCredential), StringComparison.OrdinalIgnoreCase))
string effectiveName = typeName;
int suffixIndex = effectiveName.IndexOfAny(new char[] { '[', ',' });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra allocation.

Suggested change
int suffixIndex = effectiveName.IndexOfAny(new char[] { '[', ',' });
int suffixIndex = effectiveName.IndexOfAny('[', ',');

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

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants