From c05ba5aebdc0b9ca6b230419859e9157e869051a Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Fri, 28 Jun 2024 19:51:01 -0500 Subject: [PATCH] fix: 2.1.3 simplified output and added object comment --- source/Private/Get-CISExoOutput.ps1 | 15 +++++++++++++++ source/tests/Test-NotifyMalwareInternal.ps1 | 18 +++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/source/Private/Get-CISExoOutput.ps1 b/source/Private/Get-CISExoOutput.ps1 index 08cc4f4..0f981db 100644 --- a/source/Private/Get-CISExoOutput.ps1 +++ b/source/Private/Get-CISExoOutput.ps1 @@ -237,6 +237,21 @@ function Get-CISExoOutput { # Test-NotifyMalwareInternal.ps1 # 2.1.3 Ensure notifications for internal users sending malware is Enabled # Retrieve all 'Custom' malware filter policies and check notification settings + # $malwareNotifications Mock Object + <# + $malwareNotifications = @( + [PSCustomObject]@{ + Identity = "Default" + EnableInternalSenderAdminNotifications = $true + RecommendedPolicyType = "Custom" + }, + [PSCustomObject]@{ + Identity = "Anti-malware-Policy" + EnableInternalSenderAdminNotifications = $true + RecommendedPolicyType = "Custom" + } + ) + #> $malwareNotifications = Get-MalwareFilterPolicy | Where-Object { $_.RecommendedPolicyType -eq 'Custom' } # [object[]] return $malwareNotifications diff --git a/source/tests/Test-NotifyMalwareInternal.ps1 b/source/tests/Test-NotifyMalwareInternal.ps1 index b87c381..380bcf5 100644 --- a/source/tests/Test-NotifyMalwareInternal.ps1 +++ b/source/tests/Test-NotifyMalwareInternal.ps1 @@ -27,6 +27,7 @@ function Test-NotifyMalwareInternal { #. .\source\Classes\CISAuditResult.ps1 # Initialization code, if needed $recnum = "2.1.3" + Write-Verbose "Running Test-NotifyMalwareInternal for $recnum..." } process { @@ -34,6 +35,21 @@ function Test-NotifyMalwareInternal { # 2.1.3 Ensure notifications for internal users sending malware is Enabled # Retrieve all 'Custom' malware filter policies and check notification settings + # $malwareNotifications Mock Object + <# + $malwareNotifications = @( + [PSCustomObject]@{ + Identity = "Default" + EnableInternalSenderAdminNotifications = $true + RecommendedPolicyType = "Custom" + }, + [PSCustomObject]@{ + Identity = "Anti-malware-Policy" + EnableInternalSenderAdminNotifications = $true + RecommendedPolicyType = "Custom" + } + ) + #> $malwareNotifications = Get-CISExoOutput -Rec $recnum # Condition B: Using PowerShell, the `NotifyInternal` property in the anti-malware policy is set to `True` and includes at least one valid email address for notifications. @@ -60,7 +76,7 @@ function Test-NotifyMalwareInternal { "All custom malware policies have notifications enabled." } else { - "Misconfigured Policies: $($policiesToReport -join ', ')" + "Misconfigured Policies: $($policiesToReport -join '`n')" } # Create and populate the CISAuditResult object