Skip to content

Read-Host -MaskInput -Prompt 'foo' doesn't mask the input #13011

@SteveL-MSFT

Description

@SteveL-MSFT

#10908 added a -MaskInput switch to Read-Host to allow reading sensitive input from the user. However, when used with -Prompt, the -MaskInput switch is no longer in effect thus showing what the user is typing.

Steps to reproduce

read-host -MaskInput -Prompt "Tell me your secret"

Expected behavior

Tell me your secret: ****

Actual behavior

Tell me your secret: test

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.0-preview.3
PSEdition                      Core
GitCommitId                    7.1.0-preview.3-90-g3d003cb227ebe165d450f558ea48876473050086
OS                             Darwin 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the product

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions