`Server errors alert, they never ban` and `Observe mode records the decision and
blocks nothing` are the two claims that protect honest traffic from this WAF: a
bad deploy must not lock out the site's own visitors, and a dry run must be
judgeable before it is allowed to act. Both were proven in-process, against
`FakeUpstream`, in `EdgeBlockingTests`. Neither had ever been proven against the
image users actually run. And `GET /admin-api/alerts` appeared in **zero** gate
scripts — the operator-visible half of the alerting pillar had no gate at all,
which is how the console gate found its first bug: everything below the surface
looks fine while nothing reads it.
`deploy/upstream.conf` is nginx's own default plus one path that answers 502,
mounted read-only into the compose upstream. `scripts/compose-smoke.sh` grew two
sections, 28 → **35 assertions**:
- server errors alert, and never ban
a 502 reaches the client through the edge / four 502s did not ban the source
that saw them / no engine ban written / a server_error_streak alert exists
- Observe mode records the decision and blocks nothing
five refusals still reach the upstream / no ban written / the dry run is
visible as a candidate_ban alert
Numbers: host **35 passed, 0 failed**; the same script in the Linux rehearsal
(`docker:cli` against the host daemon) **35 passed, 0 failed**.
Two lessons about counting, both written into the script:
- The data volume survives `compose down`, so an absolute alert count asserts
history rather than this run. Alerts are counted as a delta now.
- The alert is written *after* the response is, so a count read the instant the
last request returns undercounts. The first version of the measurement line
printed 1 where the settled number is 2. A number that is wrong by a race is
worse than no number, so the count is taken after a pause.
The measurement itself is the finding: **4 requests past N=3 wrote 2 alert rows**
— one row per response past the threshold, not one per source. A real 5xx storm
therefore writes at request rate. Retention ages alerts out (`BanRetention`), so
they do not accumulate forever, but the write rate is a number an operator should
know before their upstream falls over.
Honest about the fixture: the 502 is nginx returning it directly, not an
application failing behind nginx. The edge's classifier sees a status code on a
socket, which is exactly what the rule is about; the fixture does not simulate a
crashed process, and nothing should read it as if it did.
31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
# The demo upstream in docker-compose.yml. Deliberately close to nginx's own
|
|
# default so the compose file still demonstrates the honest case: an application
|
|
# the edge knows nothing about, where a missing page is a 404 and the edge has no
|
|
# opinion about it.
|
|
#
|
|
# One addition: /boom answers 502. Not because the demo is broken, but because
|
|
# the "server errors alert, they never ban" rule is the most important safety
|
|
# property in this project — a bad deploy must not lock out the site's own
|
|
# visitors — and until now it was proven only in-process, against a fake
|
|
# upstream. scripts/compose-smoke.sh hits /boom three times from one source and
|
|
# asserts the source is still not banned and that an alert exists. In the shipped
|
|
# image, over a socket.
|
|
#
|
|
# Nothing in this file is used by the edge. It is the upstream's own config.
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
}
|
|
|
|
# 502 on purpose, for the gate. A real 502 is the upstream failing; nginx
|
|
# returning one directly is the same status on the same wire, which is all
|
|
# the edge's classifier sees.
|
|
location = /boom {
|
|
return 502;
|
|
}
|
|
}
|