HTTPProxy using a TrafficProtectionPolicy resource.
When NSO reconciles an HTTPProxy, it creates a gateway.networking.k8s.io/v1 HTTPRoute with the same name and namespace. The TrafficProtectionPolicy targets this HTTPRoute — targeting the HTTPProxy directly is not supported.
The WAF is powered by Coraza and the OWASP Core Rule Set (CRS). It inspects HTTP requests and responses for common attack patterns including SQL injection, XSS, and other OWASP Top 10 threats.
Overview
At a high level, this setup:- Creates a
TrafficProtectionPolicyinObservemode to baseline traffic without blocking - Reviews detected violations
- Transitions to
Enforcemode once the ruleset is tuned
WAF policies default to
Observe mode when mode is not specified. Always start in Observe mode before enforcing — this prevents unexpected blocking of legitimate traffic.Prerequisites
datumctlinstalled and authenticated- A valid Project
- An existing
HTTPProxyto attach the policy to
Configuration Steps
Step 1: Set Variables
Windows (PowerShell)
macOS / Linux
Step 2: Apply WAF in Observe Mode
Start by attaching the WAF inObserve mode. Violations are logged but traffic is not blocked.
Windows (PowerShell)
macOS / Linux
Step 3: Verify Policy Attachment
Accepted=True and is attached to the correct proxy.
Step 4: Switch to Enforce Mode
After observing traffic and confirming no false positives, switch the mode toEnforce.
Windows (PowerShell)
macOS / Linux
Configuration Reference
Paranoia Levels
Paranoia level controls how aggressively the CRS applies rules. Higher levels catch more threats but increase false-positive risk.detection and blocking can be set independently. A common pattern is to detect at a higher level than you block, allowing you to see what stricter rules would catch before enforcing them.
Score Thresholds
The OWASP CRS uses anomaly scoring — each rule match adds to a running score. The request is blocked when the score exceeds the threshold.
Lower thresholds block more aggressively. The defaults (5 inbound, 4 outbound) are the OWASP CRS recommended starting values.
Rule Exclusions
Use rule exclusions to suppress specific rules causing false positives. Exclusions apply globally to the policy.ids over broad tags.
Targeting a Specific Rule (sectionName)
By default, aTrafficProtectionPolicy applies to the entire HTTPProxy. To scope it to a single named rule, use sectionName:
sectionName must match the name field of a rule in the HTTPProxy. NSO creates the HTTPRoute with matching rule names.
Verification
Test with a Known Attack Pattern
Send a request containing a SQL injection pattern to confirm the WAF detects it:Observe mode: request passes through, violation is logged.
In Enforce mode: expected response is 403 Forbidden.
Cleanup
Windows (PowerShell)
macOS / Linux
Troubleshooting
Best Practices
- Always start in
Observemode and run for at least a few days of representative traffic before enforcing - Set
detectionone level higher thanblockingto preview the impact of stricter rules before applying them - Use specific rule
idsfor exclusions rather than broadtags— this minimizes the attack surface opened by exclusions - Keep
scoreThresholds.inboundat 5 or higher initially; tuning downward after false positives are addressed - Apply one policy per proxy, targeting with
sectionNamewhen you need different rules for different routes
Summary
- WAF policies use
kind: TrafficProtectionPolicyatnetworking.datumapis.com/v1alpha modedefaults toObserve— always confirm before assuming enforcement is activeruleSets[].typemust beOWASPCoreRuleSet— it is currently the only supported ruleset typetargetRefsmust usegroup: gateway.networking.k8s.ioandkind: HTTPRoute— NSO creates anHTTPRoutewith the same name as theHTTPProxy; usesectionNameto scope to a single route rule- Start with paranoia level 1 blocking, level 2 detection, and OWASP default score thresholds (5/4)