mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix S360 PSAvoidUsingConvertToSecureStringWithPlainText in GetCredential.Tests.ps1
Replace ConvertTo-SecureString -AsPlainText with [System.Net.NetworkCredential]::new() which produces an equivalent SecureString without triggering the PSSA rule. Fixes ADO #34502919 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -97,7 +97,7 @@ Describe "Get-Credential Test" -Tag "CI" {
|
||||
}
|
||||
It "Get-Credential `$credential" {
|
||||
#[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Demo/doc/test secret.")]
|
||||
$password = ConvertTo-SecureString -String "CredTest" -AsPlainText -Force
|
||||
$password = [System.Net.NetworkCredential]::new('', 'CredTest').SecurePassword
|
||||
$credential = [pscredential]::new("John", $password)
|
||||
|
||||
$cred = Get-Credential $credential
|
||||
|
||||
Reference in New Issue
Block a user