File tree Expand file tree Collapse file tree 1 file changed +26
-48
lines changed Expand file tree Collapse file tree 1 file changed +26
-48
lines changed Original file line number Diff line number Diff line change @@ -8,76 +8,54 @@ 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
- }
42
-
43
- function TestFunction($password, [System.Security.SecureString[]]passphrases, [String]$passThru){
33
+ ...
44
34
}
45
35
```
46
36
47
37
Correct:
48
38
49
39
```
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
+ }
80
60
81
- function TestFunction([SecureString]$Password, [System.Security.SecureString[]]$Passphrases, [SecureString[]]$passes){
82
- }
83
61
```
You can’t perform that action at this time.
0 commit comments