From 84c9a21a1e1c9105c8655e5f2cb7ee9ee8a9725d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Gonz=C3=A1lez?= Date: Wed, 24 May 2023 09:57:18 +0200 Subject: [PATCH] Security warning Add-MyMember --- Docs.psm1 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Docs.psm1 b/Docs.psm1 index 3934a8f..9b52c0e 100755 --- a/Docs.psm1 +++ b/Docs.psm1 @@ -1156,11 +1156,13 @@ function Add-MyMember [parameter(Mandatory)][string]$NotePropertyName, [parameter(Mandatory)][string]$NotePropertyValue ) - - if ($Object.$NotePropertyName) { - $Object.$NotePropertyName = $NotePropertyValue - } else { - $object | Add-Member -NotePropertyName $NotePropertyName -NotePropertyValue $NotePropertyValue - } + process { + + if ($Object.$NotePropertyName) { + $Object.$NotePropertyName = $NotePropertyValue + } else { + $object | Add-Member -NotePropertyName $NotePropertyName -NotePropertyValue $NotePropertyValue + } + } } -#endregion Utils \ No newline at end of file +#endregion Utils