Skip to content

Documentation fixes for AvoidUsingPlainTextForPassword.md #553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 26 additions & 48 deletions RuleDocumentation/AvoidUsingPlainTextForPassword.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,76 +8,54 @@ Password parameters that take in plaintext will expose passwords and compromise

##How to Fix

To fix a violation of this rule, please use SecurityString as the type of password parameter.
To fix a violation of this rule, please use SecureString as the type of password parameter.

##Example

Wrong:
```
function Verb-Noun
function Test-Script
{
[CmdletBinding()]
[Alias()]
[OutputType([int])]
Param
(
# Param1 help description
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
$Param1,
# Param2 help description
[int]
$Param2,
[SecureString]
[string]
$Password,
[System.Security.SecureString]
[string]
$Pass,
[SecureString[]]
[string[]]
$Passwords,
$Passphrases,
$Passwordparam
)
}

function TestFunction($password, [System.Security.SecureString[]]passphrases, [String]$passThru){
...
}
```

Correct:

```
function Test-Script
{
[CmdletBinding()]
[Alias()]
[OutputType([Int])]
Param
(
# Param1 help description
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
$Param1,
# Param2 help description
[int]
$Param2,
[SecureString]
$Password,
[System.Security.SecureString]
$Pass,
[SecureString[]]
$Passwords,
[SecureString]
$Passphrases,
[SecureString]
$PasswordParam,
[string]
$PassThru
)
...
}
function Test-Script
{
[CmdletBinding()]
[Alias()]
[OutputType([Int])]
Param
(
[SecureString]
$Password,
[System.Security.SecureString]
$Pass,
[SecureString[]]
$Passwords,
[SecureString]
$Passphrases,
[SecureString]
$PasswordParam
)
...
}

function TestFunction([SecureString]$Password, [System.Security.SecureString[]]$Passphrases, [SecureString[]]$passes){
}
```