Skip to content

Commit 2856852

Browse files
committed
fix(orca): validate ZAP-supported spam actions
Update ORCA121 to inspect hosted content filter policies instead of quarantine policies and flag SpamAction or PhishSpamAction values that Zero Hour Autopurge cannot remediate. This adds clearer pass/fail output with per-setting details and documents the test intent.
1 parent 25f38c5 commit 2856852

1 file changed

Lines changed: 46 additions & 4 deletions

File tree

Modules/CIPPTests/Public/Tests/ORCA/Identity/Invoke-CippTestORCA121.ps1

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,62 @@ function Invoke-CippTestORCA121 {
22
<#
33
.SYNOPSIS
44
Supported filter policy action used
5+
6+
.DESCRIPTION
7+
ORCA121 (area: Zero Hour Autopurge). ZAP can only act on a message that was delivered to the
8+
Junk Email folder or quarantined, so it is inert when a policy's spam or phish action is one
9+
that leaves the message in place (e.g. AddXHeader, ModifySubject, NoAction). This checks that
10+
SpamAction and PhishSpamAction on each anti-spam policy are actions ZAP supports.
11+
12+
.FUNCTIONALITY
13+
Internal
514
#>
615
param($Tenant)
716

817
try {
9-
$Policies = Get-CIPPTestData -TenantFilter $Tenant -Type 'ExoQuarantinePolicy'
18+
$Policies = Get-CIPPTestData -TenantFilter $Tenant -Type 'ExoHostedContentFilterPolicy'
1019

1120
if (-not $Policies) {
1221
Add-CippTestResult -TenantFilter $Tenant -TestId 'ORCA121' -TestType 'Identity' -Status 'Skipped' -ResultMarkdown 'No data found in database. This may be due to missing required licenses or data collection not yet completed.' -Risk 'Low' -Name 'Supported filter policy action used' -UserImpact 'Medium' -ImplementationEffort 'Low' -Category 'Quarantine'
1322
return
1423
}
1524

16-
$Status = 'Passed'
17-
$Result = [System.Text.StringBuilder]::new("Quarantine policies are configured to support Zero Hour Auto Purge.`n`n")
18-
$null = $Result.Append("**Total Policies:** $($Policies.Count)")
25+
# Actions ZAP can act on, per ORCA121. Anything else leaves the message in the inbox,
26+
# where ZAP has nothing to purge.
27+
$SupportedActions = @('MoveToJmf', 'Redirect', 'Delete', 'Quarantine')
28+
29+
$Failures = [System.Collections.Generic.List[object]]::new()
30+
$PolicyCount = 0
31+
32+
foreach ($Policy in $Policies) {
33+
$PolicyCount++
34+
# ORCA evaluates the two actions as separate config items, so a policy can fail on
35+
# one and pass on the other; report them independently rather than per-policy.
36+
foreach ($Setting in @('SpamAction', 'PhishSpamAction')) {
37+
$Value = $Policy.$Setting
38+
if ($Value -notin $SupportedActions) {
39+
$Failures.Add([PSCustomObject]@{
40+
Policy = $Policy.Identity ?? $Policy.Name
41+
Setting = $Setting
42+
Value = if ($null -eq $Value -or $Value -eq '') { 'Not set' } else { $Value }
43+
}) | Out-Null
44+
}
45+
}
46+
}
47+
48+
if ($Failures.Count -eq 0) {
49+
$Status = 'Passed'
50+
$Result = [System.Text.StringBuilder]::new("✅ **Pass**: All $PolicyCount anti-spam policy/policies use a filter action that Zero Hour Auto Purge supports.`n`n")
51+
$null = $Result.Append("Supported actions: $($SupportedActions -join ', ').")
52+
} else {
53+
$Status = 'Failed'
54+
$Result = [System.Text.StringBuilder]::new("❌ **Fail**: $($Failures.Count) setting(s) across $PolicyCount anti-spam policy/policies use an action that Zero Hour Auto Purge cannot act on:`n`n")
55+
$null = $Result.Append("| Policy | Setting | Current Action | Supported |`n")
56+
$null = $Result.Append("| :----- | :------ | :------------- | :-------- |`n")
57+
foreach ($Failure in $Failures) {
58+
$null = $Result.Append("| $($Failure.Policy) | $($Failure.Setting) | $($Failure.Value) | $($SupportedActions -join ', ') |`n")
59+
}
60+
}
1961

2062
Add-CippTestResult -TenantFilter $Tenant -TestId 'ORCA121' -TestType 'Identity' -Status $Status -ResultMarkdown $Result -Risk 'Low' -Name 'Supported filter policy action used' -UserImpact 'Medium' -ImplementationEffort 'Low' -Category 'Quarantine'
2163

0 commit comments

Comments
 (0)