File tree Expand file tree Collapse file tree 1 file changed +17
-40
lines changed Expand file tree Collapse file tree 1 file changed +17
-40
lines changed Original file line number Diff line number Diff line change @@ -8,40 +8,29 @@ Password parameters that take in plaintext will expose passwords and compromise
8
8
9
9
##How to Fix
10
10
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.
12
12
13
13
##Example
14
14
15
15
Wrong:
16
16
```
17
- function Verb-Noun
17
+ function Test-Script
18
18
{
19
19
[CmdletBinding()]
20
20
[Alias()]
21
21
[OutputType([int])]
22
22
Param
23
23
(
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]
33
25
$Password,
34
- [System.Security.SecureString ]
26
+ [string ]
35
27
$Pass,
36
- [SecureString []]
28
+ [string []]
37
29
$Passwords,
38
30
$Passphrases,
39
31
$Passwordparam
40
32
)
41
33
}
42
-
43
- function TestFunction($password, [System.Security.SecureString[]]passphrases, [String]$passThru){
44
- }
45
34
```
46
35
47
36
Correct:
@@ -54,30 +43,18 @@ Correct:
54
43
[OutputType([Int])]
55
44
Param
56
45
(
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
- ...
46
+ [SecureString]
47
+ $Password,
48
+ [System.Security.SecureString]
49
+ $Pass,
50
+ [SecureString[]]
51
+ $Passwords,
52
+ [SecureString]
53
+ $Passphrases,
54
+ [SecureString]
55
+ $PasswordParam
56
+ )
57
+ ...
79
58
}
80
59
81
- function TestFunction([SecureString]$Password, [System.Security.SecureString[]]$Passphrases, [SecureString[]]$passes){
82
- }
83
60
```
You can’t perform that action at this time.
0 commit comments