Skip to content

Commit 1c0f397

Browse files
Suppress PSAvoidUsingConvertToSecureStringWithPlainText in makepfxcert used in tests (#3698)
* Suppress PSAvoidUsingConvertToSecureStringWithPlainText in makepfxcert.ps1 * Update src/Microsoft.Data.SqlClient/tests/ManualTests/makepfxcert.ps1 Co-authored-by: Copilot <[email protected]> * Apply suggestion from @cheenamalhotra --------- Co-authored-by: Copilot <[email protected]>
1 parent 22b233b commit 1c0f397

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Microsoft.Data.SqlClient/tests/ManualTests/makepfxcert.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ function Invoke-SqlServerCertificateCommand {
131131
Write-Output "Converting certificate to pfx..."
132132
Write-Output "Cert:\LocalMachine\my\$($certificate.Thumbprint)"
133133

134+
# PSScriptAnalyzer rule suppression
135+
# Suppress the 'PSAvoidUsingConvertToSecureStringWithPlainText' rule for the next line as this is a test certificate with no password
136+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "", Justification="Test certificate with no real secret")]
134137
$pwd = ConvertTo-SecureString -String 'nopassword' -Force -AsPlainText
138+
135139
# Export the certificate to a pfx format
136140
Export-PfxCertificate -Password $pwd -FilePath "$OutDir\localhostcert.pfx" -Cert "Cert:\LocalMachine\my\$($certificate.Thumbprint)"
137141

0 commit comments

Comments
 (0)