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
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
1515Wrong:
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
4737Correct:
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```
You can’t perform that action at this time.
0 commit comments