Skip to content

Commit 962246d

Browse files
author
Quoc Truong
committed
Merge pull request #226 from PowerShell/FixAvoidUsingPlainTextForPasswordParameter
Fix parameters missing in a conditional statement of the rule AvoidUsingPlainTextForPasswordParameter
2 parents b10fb39 + 5a58464 commit 962246d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Rules/AvoidUsingPlainTextForPassword.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
5555
}
5656
}
5757

58-
if (hasPwd && (!paramType.IsArray && (paramType == typeof(String) || paramType == typeof(object)))
59-
|| (paramType.IsArray && (paramType.GetElementType() == typeof(String) || paramType.GetElementType() == typeof(object))))
58+
if (hasPwd && ((!paramType.IsArray && (paramType == typeof(String) || paramType == typeof(object)))
59+
|| (paramType.IsArray && (paramType.GetElementType() == typeof(String) || paramType.GetElementType() == typeof(object)))))
6060
{
6161
yield return new DiagnosticRecord(
6262
String.Format(CultureInfo.CurrentCulture, Strings.AvoidUsingPlainTextForPasswordError, paramAst.Name),

Tests/Rules/AvoidUsingPlainTextForPasswordNoViolations.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
[securestring]
2727
$passwordparam,
2828
[string]
29-
$PassThru
29+
$PassThru,
30+
[string[]]
31+
$shouldnotraiseerror
3032
)
3133

3234
Begin

0 commit comments

Comments
 (0)