fix: 2.1.3 simplified output and added object comment

This commit is contained in:
DrIOS
2024-06-28 19:51:01 -05:00
parent 73c1ecf30e
commit c05ba5aebd
2 changed files with 32 additions and 1 deletions

View File

@@ -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

View File

@@ -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