Skip to content

Commit 6bc97be

Browse files
authored
Network - 26880 - Request Body Inspection is enabled in Azure Front Door WAF (#1043)
* made changes as spec update * made changes to mode status
1 parent 08ddf3f commit 6bc97be

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/powershell/tests/Test-Assessment.26880.ps1

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,23 @@ resources
8888
return
8989
}
9090

91-
# Check if all policies have request body inspection enabled
92-
$passed = ($policies | Where-Object { $_.RequestBodyCheck -ne 'Enabled' }).Count -eq 0
91+
# Compute compliance once per policy to avoid duplicating the predicate logic
92+
foreach ($policy in $policies) {
93+
$policy | Add-Member -NotePropertyName 'IsCompliant' -NotePropertyValue (
94+
$policy.RequestBodyCheck -eq 'Enabled' -and
95+
$policy.EnabledState -eq 'Enabled' -and
96+
$policy.Mode -eq 'Prevention'
97+
)
98+
}
99+
100+
# Check if all policies are compliant
101+
$passed = ($policies | Where-Object { -not $_.IsCompliant }).Count -eq 0
93102

94103
if ($passed) {
95-
$testResultMarkdown = "✅ All Azure Front Door WAF policies attached to Azure Front Door have request body inspection enabled.`n`n%TestResult%"
104+
$testResultMarkdown = "✅ All Azure Front Door WAF policies attached to Azure Front Door are enabled, running in Prevention mode, and have request body inspection enabled.`n`n%TestResult%"
96105
}
97106
else {
98-
$testResultMarkdown = "❌ One or more Azure Front Door WAF policies attached to Azure Front Door have request body inspection disabled.`n`n%TestResult%"
107+
$testResultMarkdown = "❌ One or more Azure Front Door WAF policies attached to Azure Front Door are disabled, running in Detection mode, or have request body inspection disabled, leaving applications vulnerable to body-based attacks that bypass WAF rule evaluation.`n`n%TestResult%"
99108
}
100109
#endregion Assessment Logic
101110

@@ -117,15 +126,13 @@ resources
117126
# Calculate status indicators
118127
$requestBodyCheckDisplay = if ($item.RequestBodyCheck -eq 'Enabled') { '✅ Enabled' } else { '❌ Disabled' }
119128
$enabledStateDisplay = if ($item.EnabledState -eq 'Enabled') { '✅ Enabled' } else { '❌ Disabled' }
120-
$modeDisplay = if ($item.Mode -eq 'Prevention') { '✅ Prevention' } else { "⚠️ $($item.Mode)" }
121-
$status = if ($item.RequestBodyCheck -eq 'Enabled') { '✅ Pass' } else { '❌ Fail' }
129+
$modeDisplay = if ($item.Mode -eq 'Prevention') { '✅ Prevention' } else { " $($item.Mode)" }
130+
$status = if ($item.IsCompliant) { '✅ Pass' } else { '❌ Fail' }
122131

123132
$tableRows += "| $policyMd | $subMd | $enabledStateDisplay | $modeDisplay | $requestBodyCheckDisplay | $status |`n"
124133
}
125134

126135
$formatTemplate = @'
127-
128-
129136
## [{0}]({1})
130137
131138
| Policy name | Subscription name | Enabled state | WAF mode | Request body check | Status |

0 commit comments

Comments
 (0)