fix: 2.1.3 aligned with test-template
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
function Test-NotifyMalwareInternal {
|
function Test-NotifyMalwareInternal {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
# Aligned
|
||||||
# Parameters can be added if needed
|
# Parameters can be added if needed
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
|
# Dot source the class script if necessary
|
||||||
$auditResults = @()
|
#. .\source\Classes\CISAuditResult.ps1
|
||||||
|
# Initialization code, if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
@@ -24,10 +26,23 @@ function Test-NotifyMalwareInternal {
|
|||||||
|
|
||||||
# Determine the result based on the presence of custom policies without notifications
|
# Determine the result based on the presence of custom policies without notifications
|
||||||
$result = $policiesToReport.Count -eq 0
|
$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 = [CISAuditResult]::new()
|
||||||
$auditResult.Status = if ($result) { "Pass" } else { "Fail" }
|
$auditResult.Status = if ($result) { "Pass" } else { "Fail" }
|
||||||
$auditResult.ELevel = "E3"
|
$auditResult.ELevel = "E3"
|
||||||
@@ -42,13 +57,11 @@ function Test-NotifyMalwareInternal {
|
|||||||
$auditResult.IG3 = $true
|
$auditResult.IG3 = $true
|
||||||
$auditResult.Result = $result
|
$auditResult.Result = $result
|
||||||
$auditResult.Details = $details
|
$auditResult.Details = $details
|
||||||
$auditResult.FailureReason = $failureReason
|
$auditResult.FailureReason = $failureReasons
|
||||||
|
|
||||||
$auditResults += $auditResult
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
# Return auditResults
|
# Return the audit result
|
||||||
return $auditResults
|
return $auditResult
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user