Closed ay-azara closed 1 year ago
@ay-azara It is working. You are just missing a second p
in the spelling of SuppressMessageAttribute
:
function Test {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', "Password")]
param(
[String] $Password
)
}
Whoops! That's embarrassing. Sorry about that.
No worries :-)
Steps to reproduce
Open Powershell file in VSCode Paste snippet
Expected behavior
Warning is suppressed
Actual behavior
Warning persists
Environment data
Commentary
I see that this was fixed back in 2016 and there are rules in place that should be testing this but I can't see whether they pass or fail. Am I missing something or is this a me thing? For the record, I am using PSCred but for development this was faster and I happened to notice. I also have a potential use case where I need the password to be $null and even if I used a SecureString for this I can't pass that to the Win32 api I'm calling since it only takes a string.