check / check (push) Failing after 12m17s
`smallwebwaf rproxy` reads the first 64 KiB of each body, asks servewaf over HTTP/1.1, and passes what servewaf allows to the app within its limits. Any other answer goes to the visitor as servewaf gave it. SWRP_DEFAULT_DISPOSITION decides only when servewaf cannot be connected to, does not answer at all, or does not answer within SWRP_TIMEOUT_MS. A method SPEC.md does not list gets 405. Duplication: internal/rproxy copies passing-on code from internal/proxy until #172 removes the originals. Rule suppressed: gosec G704 and G705; gosec at internal/smallwebwaf/rproxy_test.go:431; tagliatelle at internal/requestlog/requestlog.go:201; paralleltest on one test. Judgement call: an answer over 1 MiB, or with a status below 200, gets 502. Judgement call: every target not starting with one / gets 400. Model: opus-5-5
2.4 KiB
2.4 KiB
Admin endpoints
The endpoints under /_smallwebwaf/, what each takes and what each answers.
"Admin endpoints" in SPEC.md says which checks they go through
and how their tokens work.
GET /_smallwebwaf/healthz:200andok, to anyone.GET /_smallwebwaf/metrics: the metrics, forSWWAF_METRICS_TOKEN(seemetrics.md).GET /_smallwebwaf/bans: every ban held, underbans, each asbans.jsonlists it. NeedsSWWAF_ADMIN_TOKEN, as do the three below.POST /_smallwebwaf/bans: bans a netblock. The body is a JSON object ofnetblock,durationand, if you like,reason.netblockis a netblock such as203.0.113.0/24, or a client's address, which bans its IPv4 netblock (SWWAF_BAN_SCOPE_V4_PREFIX) or its IPv6 group.durationis a duration such as1hor7d, orpermanent. A bad body is answered400, saying what is wrong:- one that is not such an object, or has another field;
- one longer than 4 KiB;
- one that names an IPv4-mapped netblock, or an address with a zone.
DELETE /_smallwebwaf/bans/<client>: lifts every active ban covering the address<client>. It answers404when none is active.GET /_smallwebwaf/clients/<ip>: whatsmallwebwafknows of the client. Underclient, its counters and history asclients.jsonholds them, ornullwhenclients.jsondoes not hold it. Underbans, every ban covering the address, with its notes.
Examples
With SWWAF_ADMIN_TOKEN set, and the token in $TOKEN:
# Every ban.
curl -H "Authorization: Bearer $TOKEN" https://app.example/_smallwebwaf/bans
# Ban 203.0.113.0/24 for seven days.
curl -H "Authorization: Bearer $TOKEN" \
--json '{"netblock": "203.0.113.0/24", "duration": "7d", "reason": "probes for logins"}' \
https://app.example/_smallwebwaf/bans
# Lift the bans on 203.0.113.9.
curl -H "Authorization: Bearer $TOKEN" -X DELETE \
https://app.example/_smallwebwaf/bans/203.0.113.9
# What smallwebwaf knows of 203.0.113.9.
curl -H "Authorization: Bearer $TOKEN" \
https://app.example/_smallwebwaf/clients/203.0.113.9
servewaf
smallwebwaf servewaf answers these endpoints at its own address. No check runs
on those requests (see "servewaf" in SPEC.md).
rproxy
smallwebwaf rproxy answers only the health check, at its own address. It asks
servewaf about any other request under /_smallwebwaf/ (see "rproxy" in
SPEC.md).