no-plain-text-password
What it does
Section titled “What it does”Reports a [string] parameter whose name contains password, passphrase or cred.
Why it matters
Section titled “Why it matters”A [string] stays in memory as clear text and is easy to log or to show in history and transcripts. [SecureString] and [PSCredential] keep the secret protected and make the cmdlet fit with the credential handling of other commands.
To fix, take a [SecureString] or a [PSCredential].
Example
Section titled “Example”... param( [string]$Password, [Parameter(Mandatory)][string] $UserPassphrase = 'x', [securestring]$Secret, [string]$Name,...$null = 1$global:LASTEXITCODE = 1...function Show-It($Error, [string]$Credential) { }Configuration
Section titled “Configuration”powershell: lint: rules: no-plain-text-password: warn # off, warn (default), errorEnabled by the presets: powershell/psscriptanalyzer.
Suppress one line with sudsy-disable-next-line no-plain-text-password in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| psscriptanalyzer | PSAvoidUsingPlainTextForPassword |
partial | SuppressMessageAttribute is not honored (see the scope). |