From 380cd15eedeffa4e4a3673bb3b199ff87b37ccca Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 4 Feb 2020 13:21:06 -0800 Subject: [PATCH] Update to `CredScan v2` (#11765) --- .vsts-ci/templates/credscan.yml | 1 + ...Command.Cmdlets.LocalAccounts.LocalUser.Tests.ps1 | 2 ++ tools/credScan/suppress.json | 12 ++++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.vsts-ci/templates/credscan.yml b/.vsts-ci/templates/credscan.yml index a46bd82b87..f6ed5b8fd2 100644 --- a/.vsts-ci/templates/credscan.yml +++ b/.vsts-ci/templates/credscan.yml @@ -15,6 +15,7 @@ jobs: displayName: 'Scan for Secrets' inputs: suppressionsFile: tools/credScan/suppress.json + toolMajorVersion: V2 debugMode: false - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2 diff --git a/test/powershell/Modules/Microsoft.PowerShell.LocalAccounts/Pester.Command.Cmdlets.LocalAccounts.LocalUser.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.LocalAccounts/Pester.Command.Cmdlets.LocalAccounts.LocalUser.Tests.ps1 index a0ea2f786b..a3f890b699 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.LocalAccounts/Pester.Command.Cmdlets.LocalAccounts.LocalUser.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.LocalAccounts/Pester.Command.Cmdlets.LocalAccounts.LocalUser.Tests.ps1 @@ -334,6 +334,7 @@ try { } It "Can set Password value at max 256" { + #[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Demo/doc/test secret.")] $result = New-LocalUser TestUserNew1 -Password (ConvertTo-SecureString ("135@"+"A"*252) -AsPlainText -Force) $result.Name | Should BeExactly TestUserNew1 @@ -762,6 +763,7 @@ try { } It "Can set Password value at max 256" { + #[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Demo/doc/test secret.")] Set-LocalUser -Name TestUserSet1 -Password (ConvertTo-SecureString ("123@"+"A"*252) -asplaintext -Force) $result = Get-LocalUser -Name TestUserSet1 diff --git a/tools/credScan/suppress.json b/tools/credScan/suppress.json index 304a9ba855..55e607b1b0 100644 --- a/tools/credScan/suppress.json +++ b/tools/credScan/suppress.json @@ -2,12 +2,16 @@ "tool": "Credential Scanner", "suppressions": [ { - "file": "\\test\\tools\\Modules\\WebListener\\ClientCert.pfx", + "file": "\\test\\tools\\Modules\\WebListener\\ClientCert.pfx", "_justification": "Test certificate with private key" }, { - "file": "\\test\\tools\\Modules\\WebListener\\ServerCert.pfx", + "file": "\\test\\tools\\Modules\\WebListener\\ServerCert.pfx", "_justification": "Test certificate with private key" - } - ] + }, + { + "file": "\\test\\powershell\\Modules\\Microsoft.PowerShell.Security\\certificateCommon.psm1", + "_justification": "Test certificate with private key and inline suppression isn't working" + } + ] }