docs(waf): correct WAF mode wording and add Reviewing detections #16

Merged
jknapp merged 3 commits from docs/waf-mode-wording into main 2026-11-17 22:03:39 +00:00
2 changed files with 63 additions and 23 deletions

No files matched your search

+62 -22
View File
@@ -1,28 +1,40 @@
---
title: Coraza WAF rules
description: Set the global WAF mode, tune individual rules, audit blocked requests, and add per-host overrides.
description: What each WAF mode really does, how to review logged detections and blocked requests, tune individual rules, and add per-host overrides.
sidebar:
order: 3
---
import { Aside } from '@astrojs/starlight/components';
import { Aside, Steps } from '@astrojs/starlight/components';
import SuperAdmin from '~/content/partials/super-admin-callout.mdx';
import AdminSignIn from '~/content/partials/admin-signin.mdx';
import Support from '~/content/partials/support-link.mdx';
<SuperAdmin />
[Coraza](https://coraza.io/) is an open-source web-application firewall (WAF) that runs as a sidecar in front of your sites. The **Coraza Rules** page in the admin sidebar gives you a UI to set the global mode, tune individual rules, and audit blocked requests — all without rebuilding the sidecar image.
[Coraza](https://coraza.io/) is an open-source web-application firewall (WAF) that runs as a sidecar in front of your sites. The **Coraza Rules** page in the admin sidebar gives you a UI to set the global mode, tune individual rules, and review detections and blocked requests — all without rebuilding the sidecar image.
![Coraza Rules page — Firing rules tab](~/assets/screenshots/whp/admin-coraza.png)
## Global WAF mode
A coloured pill at the top of the page shows the **Global WAF mode** with a **change** link:
The mode is set in **Server Settings → Security** (the **change** link next to the pill on the Coraza Rules page takes you there). The same names are used in both places: **Off**, **Detect only** and **Enforce**.
- **Off** — no inspection. Requests pass untouched.
- **Detect** — inspect and log matches; do not block. Use during a roll-out or while validating a rule change.
- **Enforce** — inspect and block anything that matches an enforcing rule.
### What each mode does
| Mode | What happens to a matching request |
|---|---|
| **Off** | No inspection. The WAF sidecar is stopped and requests pass untouched. |
| **Detect only** | Rules are evaluated and logged to the WAF audit log. A small set of always-on, high-confidence protections still **blocks in this mode too**: probes for sensitive files (`/etc/passwd`, `.env`, `.git`), remote command execution, PHP and Java code injection (including Log4Shell), restricted file types such as `.bak` and `.sql`, and known CVE exploits. Everything else is logged only. |
| **Enforce** | The same always-on protections, plus two body checks: a complete multipart or JSON request body that fails to parse is rejected, and so is a JSON body with more than 1000 arguments (the visitor gets the same 403 block page with a reference ID as for any other block). SQL injection, cross-site scripting, scanner signatures and the anomaly score are **logged but not blocked**, to avoid breaking legitimate sites and editors. |
<Aside type="caution" title="Enforce does not mean full CRS blocking">
The two modes are much closer than their names suggest. In both, a request that only trips SQL injection, cross-site scripting or scanner rules is logged and still served, however high its anomaly score. Use the audit log to see what *would* have matched.
</Aside>
<Aside type="note" title="Detect only is not a no-block mode">
The always-on protections are built into the WAF image and switch blocking on for the single request that matches them, so they apply in **Detect only** as well. When one of them matches, the whole request is blocked, even if SQL injection or scanner rules also fired on it. The Coraza Rules page shows the exact per-rule behaviour in the **State** column.
</Aside>
The WAF is **fail-open**: if the Coraza sidecar is itself unhealthy, traffic still flows.
@@ -30,7 +42,7 @@ The WAF is **fail-open**: if the Coraza sidecar is itself unhealthy, traffic sti
<AdminSignIn />
## The three tabs
## The four tabs
### Firing rules
@@ -42,7 +54,7 @@ Columns:
- **Hits** — how many times the rule fired in the time window.
- **Top hosts** — the top customer domains that triggered this rule (with per-host hit counts).
- **Top URIs** — the most common request paths that triggered it (helpful for distinguishing scans from real traffic).
- **State** — per-rule override of the global mode. Options: `(default → enforce)`, `(default → detect)`, `(default → score)`, `off`. Picking anything other than `(default → …)` overrides the global mode for that rule.
- **State** — per-rule override of the global mode. Options: `(default → …)`, `enforce`, `detect`, `off`. The text after the arrow is what the rule does today (for example `detect`, `score` or `enforce`), based on the global mode and the built-in high-confidence list. A rule marked `score` only adds to the anomaly score and is logged, not blocked, in either mode (the rule `949110` that totals the score blocks only a request that has already matched one of the always-on protections). Picking `enforce`, `detect` or `off` overrides the default for that rule.
- **Per-host** — opens a **Hosts (N)** drawer to set per-host overrides for that rule.
<Aside type="tip">
@@ -55,20 +67,20 @@ The full OWASP Core Rule Set catalogue (v4 families: 901, 905, 911, 913, 920–9
### Activity
A timeline / log of every WAF block in the audit window. Use it to:
The most recent 100 rule and exception changes (who changed what, and when), plus the status of the **reconciler** that applies your changes to the WAF. It also lists sites in emergency mode and any changes that could not be applied. This tab is a change log, not a list of blocked requests; for those, see *Reviewing detections* below.
- Confirm a customer report (cross-reference the **X-Request-Reference** UUID on the visitor-facing 403 page).
- Spot bursts of activity from the same source IP.
- Tune source-of-truth back-end queries — the audit is read from `security.db`.
### Customer changes
Every change customers have made themselves (for example excluding a rule on their own site), most recent first.
## Common tasks
### Roll a new site onto the WAF
1. Set the rule's **State** to `(default → detect)` for that site via the Per-host drawer.
1. Make sure the server is in **Detect only** mode (or use the Per-host drawer to keep the rules you are testing at `detect` for that site).
2. Drive normal traffic for at least 24 hours.
3. Open the **Activity** tab and filter to that host. Confirm no legitimate request is matching an enforcing rule.
4. Flip the host to **enforce**.
3. Open **Firing rules** and check which rules fired for that host. Confirm no legitimate request is matching a rule that would block (the ones whose default is `enforce`; these block in both modes).
4. Switch the mode to **Enforce** in Server Settings → Security. This adds the body-parse and JSON-argument-count rejections; the always-on protections were already active.
### Mute a noisy rule
@@ -77,13 +89,39 @@ A timeline / log of every WAF block in the audit window. Use it to:
Prefer per-host. Global mute weakens the WAF for every site.
### Reviewing detections
The WAF produces two different kinds of records, and they live in different places on the **Coraza Rules** page:
| You want to see | Where to look | Does the visitor see anything? |
|---|---|---|
| **Logged detections** — rules that matched but let the request through (in either mode, every rule outside the always-on set) | **Firing rules** tab. A rule whose **State** reads `(default → detect)` or `(default → score)` is log-only, with one exception: `949110`, which totals the score, blocks only a request that has also matched an always-on protection. | No. The page loads normally, so there is no block page and no reference ID. |
| **Blocked requests** — requests the WAF actually stopped | **Firing rules** tab, rows whose **State** reads `(default → enforce)`. **view** lists the matching requests. | Yes. The visitor gets the branded 403 page with a reference ID. |
Both kinds are counted in **Hits**; the **State** column tells you which kind a rule produces.
To review:
<Steps>
1. Open **Coraza Rules** and pick **Last 24h** or **Last 7d** at the top right.
2. On **Firing rules**, start with the highest **Hits** and look at **Top hosts** and **Top URIs** to separate scanners from real visitors.
3. For a rule you do not recognise, click **Ask AI** or open the rule from the **CRS catalog**.
4. If a rule is firing on legitimate traffic, mute it for that site only (see *Mute a noisy rule* above) rather than turning it off globally.
</Steps>
### Audit a block
Customer reports a request was wrongly blocked? The branded 403 page includes an **X-Request-Reference** UUID. Cross-reference it:
Customer reports a request was wrongly blocked? The branded 403 page shows a **reference ID** (also sent as the `X-Request-Reference` response header). This page is shown for every block, including a rejected unparsable or oversized request body in **Enforce** mode (those show rule `991900020` or `991900031` in the audit log). Ask the customer for it, then:
1. In the **Activity** tab, search for the UUID.
2. The row shows the matched rule ID, source IP, URL, and offending parameter.
3. Decide whether to mute the rule (see above) or leave it — many "false positives" turn out to be real attempts.
1. Look the reference up in the edge (HAProxy) access log on the server to find the time, client IP, host and URL of that request.
2. Find the matching transaction in the WAF audit log on the server; it names the matched rule ID, source IP, URL and offending parameter.
3. Decide whether to mute the rule (see above) or leave it. Many "false positives" turn out to be real attempts.
<Aside type="note">
If the customer cannot give you a reference ID because the request loaded normally, it was a logged-only detection and the WAF did not cause their problem. Look for the cause elsewhere (application error, permissions, caching).
</Aside>
## Implementation notes
@@ -93,9 +131,11 @@ Customer reports a request was wrongly blocked? The branded 403 page includes an
## Troubleshooting
**A rule shows enabled but doesn't fire.** Check that the host is in **detect** or **enforce** mode. A host in **off** bypasses every rule.
**A rule shows enabled but doesn't fire.** Check that the global mode is **Detect only** or **Enforce**. **Off** bypasses every rule.
**The Activity log is empty.** Confirm `coraza-spoa` is healthy on the **Services** tab of Server Settings. If it's restarting in a loop, check the container logs — usually a malformed rule file or a missing include.
**A request matched a rule but was not blocked.** Expected: in both modes only the always-on high-confidence rules block (plus, in Enforce, unparsable bodies and oversized JSON). Everything else, including SQL injection, cross-site scripting and scanner signatures, is logged only.
**The Firing rules tab is empty.** Confirm `coraza-spoa` is healthy on the **Services** tab of Server Settings. If it's restarting in a loop, check the container logs — usually a malformed rule file or a missing include.
**Edits revert on restart.** Make sure you're editing through the panel; manual edits outside the panel-managed path are overwritten.
@@ -88,7 +88,7 @@ These are issues where the underlying signal recovered before a human looked at
### Tune brute-force detection
Brute-force rules live in **Coraza Rules** (rule families CRS-913 / 921 / 942 / 949) rather than AI Monitor. AI Monitor surfaces the *effects* (error spikes) once a brute-force pattern fires, but the matching itself is in the WAF — see [Coraza WAF rules](/whp/admin/coraza-waf/).
Brute-force rules live in **Coraza Rules** (rule families CRS-913 / 921 / 942 / 949) rather than AI Monitor. AI Monitor surfaces the *effects* (error spikes) once a brute-force pattern fires, but the matching itself is in the WAF. In both **Detect only** and **Enforce** modes these rules are logged but not blocked on their own (rule `949110`, which totals the anomaly score, blocks only a request that also matched one of the always-on protections), so they show up as detections on the Coraza Rules page rather than as blocked requests. See [Coraza WAF rules](/whp/admin/coraza-waf/).
## Routing alerts