Skip to content

Commit 6eb2735

Browse files
author
Kapil Borle
committed
Merge pull request #553 from avvi00/patch-1
Documentation fixes for AvoidUsingPlainTextForPassword.md
2 parents 3485763 + fb77f16 commit 6eb2735

File tree

1 file changed

+26
-48
lines changed

1 file changed

+26
-48
lines changed

RuleDocumentation/AvoidUsingPlainTextForPassword.md

Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,76 +8,54 @@ Password parameters that take in plaintext will expose passwords and compromise
88

99
##How to Fix
1010

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

1313
##Example
1414

1515
Wrong:
1616
```
17-
function Verb-Noun
17+
function Test-Script
1818
{
1919
[CmdletBinding()]
2020
[Alias()]
2121
[OutputType([int])]
2222
Param
2323
(
24-
# Param1 help description
25-
[Parameter(Mandatory=$true,
26-
ValueFromPipelineByPropertyName=$true,
27-
Position=0)]
28-
$Param1,
29-
# Param2 help description
30-
[int]
31-
$Param2,
32-
[SecureString]
24+
[string]
3325
$Password,
34-
[System.Security.SecureString]
26+
[string]
3527
$Pass,
36-
[SecureString[]]
28+
[string[]]
3729
$Passwords,
3830
$Passphrases,
3931
$Passwordparam
4032
)
41-
}
42-
43-
function TestFunction($password, [System.Security.SecureString[]]passphrases, [String]$passThru){
33+
...
4434
}
4535
```
4636

4737
Correct:
4838

4939
```
50-
function Test-Script
51-
{
52-
[CmdletBinding()]
53-
[Alias()]
54-
[OutputType([Int])]
55-
Param
56-
(
57-
# Param1 help description
58-
[Parameter(Mandatory=$true,
59-
ValueFromPipelineByPropertyName=$true,
60-
Position=0)]
61-
$Param1,
62-
# Param2 help description
63-
[int]
64-
$Param2,
65-
[SecureString]
66-
$Password,
67-
[System.Security.SecureString]
68-
$Pass,
69-
[SecureString[]]
70-
$Passwords,
71-
[SecureString]
72-
$Passphrases,
73-
[SecureString]
74-
$PasswordParam,
75-
[string]
76-
$PassThru
77-
)
78-
...
79-
}
40+
function Test-Script
41+
{
42+
[CmdletBinding()]
43+
[Alias()]
44+
[OutputType([Int])]
45+
Param
46+
(
47+
[SecureString]
48+
$Password,
49+
[System.Security.SecureString]
50+
$Pass,
51+
[SecureString[]]
52+
$Passwords,
53+
[SecureString]
54+
$Passphrases,
55+
[SecureString]
56+
$PasswordParam
57+
)
58+
...
59+
}
8060
81-
function TestFunction([SecureString]$Password, [System.Security.SecureString[]]$Passphrases, [SecureString[]]$passes){
82-
}
8361
```

0 commit comments

Comments
 (0)