File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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
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 )
4133 }
42-
43- function TestFunction($password, [System.Security.SecureString[]]passphrases, [String]$passThru){
44- }
4534```
4635
4736Correct:
@@ -54,30 +43,18 @@ Correct:
5443 [OutputType([Int])]
5544 Param
5645 (
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+ ...
7958 }
8059
81- function TestFunction([SecureString]$Password, [System.Security.SecureString[]]$Passphrases, [SecureString[]]$passes){
82- }
8360```
You can’t perform that action at this time.
0 commit comments