-
Notifications
You must be signed in to change notification settings - Fork 400
Closed
Description
For the following code snippet in a file called test1.ps1
function foo
{
param(
[string] $Username,
[switch] $HidePassword
)
}
PSScriptAnalyzer trips PSAvoidUserNameAndPasswordParams.
PS> Invoke-ScriptAnalyzer -Path C:\tmp\test1.ps1
RuleName Severity FileName Line Message
-------- -------- -------- ---- -------
PSAvoidUsingUserNameAndPassWordPara Error test1.ps1 4 Function 'foo' has both Username and Password
ms parameters. Either set the type of the Password
parameter to SecureString or replace the Username
and Password parameters with a Credential parameter
of type PSCredential. If using a Credential
parameter in PowerShell 4.0 or earlier, please
define a credential transformation attribute after
the PSCredential type attribute.
In this case $HidePassword is clearly not intented to pass the password parameter and hence, this rule should ignore it.
Related issue: #571
Metadata
Metadata
Assignees
Labels
No labels