fix: 2.1.3 aligned with test-template

This commit is contained in:
DrIOS
2024-05-28 11:25:57 -05:00
parent 36cb3f1944
commit 3cf76bb6b3

View File

@@ -1,12 +1,14 @@
function Test-NotifyMalwareInternal {
[CmdletBinding()]
param (
# Aligned
# Parameters can be added if needed
)
begin {
$auditResults = @()
# Dot source the class script if necessary
#. .\source\Classes\CISAuditResult.ps1
# Initialization code, if needed
}
process {
@@ -24,10 +26,23 @@ function Test-NotifyMalwareInternal {
# Determine the result based on the presence of custom policies without notifications
$result = $policiesToReport.Count -eq 0
$details = if ($result) { "All custom malware policies have notifications enabled." } else { "Misconfigured Policies: $($policiesToReport -join ', ')" }
$failureReason = if ($result) { "N/A" } else { "Some custom policies do not have notifications for internal users sending malware enabled." }
# Create an instance of CISAuditResult and populate it
# Prepare failure reasons and details based on compliance
$failureReasons = if ($result) {
"N/A"
}
else {
"Some custom policies do not have notifications for internal users sending malware enabled."
}
$details = if ($result) {
"All custom malware policies have notifications enabled."
}
else {
"Misconfigured Policies: $($policiesToReport -join ', ')"
}
# Create and populate the CISAuditResult object
$auditResult = [CISAuditResult]::new()
$auditResult.Status = if ($result) { "Pass" } else { "Fail" }
$auditResult.ELevel = "E3"
@@ -42,13 +57,11 @@ function Test-NotifyMalwareInternal {
$auditResult.IG3 = $true
$auditResult.Result = $result
$auditResult.Details = $details
$auditResult.FailureReason = $failureReason
$auditResults += $auditResult
$auditResult.FailureReason = $failureReasons
}
end {
# Return auditResults
return $auditResults
# Return the audit result
return $auditResult
}
}