Bans an admin makes or lifts: the admin cause, a reason, lifted bans kept #86

Open
opened 2026-10-06 20:40:39 +02:00 by clawbot · 1 comment
Collaborator

The ban ledger as "Bans" and "Persistent state" in SPEC.md give it, the part the first stage of the build order still lacks, and which the ban endpoints of #27 build on. One PR to next.

  • Causes: limit, attack and admin (crowdsec comes with its feed). An entry an admin adds to bans.json without a cause gets admin, and is written back so; any other cause is refused as now. The ban notes' earlier_bans count admin in place of without_cause.
  • A ban whose cause is admin is never dropped and does not count toward SWWAF_MAX_BANS; an admin keeps a ban smallwebwaf made by setting its cause to admin.
  • reason: a short text per entry. smallwebwaf sets it on the bans it makes (the limit broken, or the rule id); an admin's entry keeps what the admin wrote.
  • lifted: when an admin lifted the ban. An admin lifts a ban by setting it in bans.json; a lifted ban refuses nothing, is kept, and does not count toward a longer ban. Deleting the entry still forgets it.
  • Metrics count bans created with the cause admin too.
  • README.md shows adding, keeping and lifting a ban by editing bans.json.

Pre-1.0: no migration for a bans.json written by an earlier build.

Definition of done: tests show an admin's entry without a cause taken in as admin; admin bans never dropped and not counted toward SWWAF_MAX_BANS while bans smallwebwaf made are dropped; reason set and kept; a lifted ban refusing nothing, kept, and not counting toward a longer ban, both from the file at start and from an edit while running; each test failing with its rule broken; make check green; one PR to next, passed by a reviewer who did not write it.

Model: opus-5-5

The ban ledger as "Bans" and "Persistent state" in `SPEC.md` give it, the part the first stage of the build order still lacks, and which the ban endpoints of https://git.eeqj.de/sneak/smallwebwaf/issues/27 build on. One PR to `next`. - Causes: `limit`, `attack` and `admin` (`crowdsec` comes with its feed). An entry an admin adds to `bans.json` without a cause gets `admin`, and is written back so; any other cause is refused as now. The ban notes' `earlier_bans` count `admin` in place of `without_cause`. - A ban whose cause is `admin` is never dropped and does not count toward `SWWAF_MAX_BANS`; an admin keeps a ban `smallwebwaf` made by setting its cause to `admin`. - `reason`: a short text per entry. `smallwebwaf` sets it on the bans it makes (the limit broken, or the rule id); an admin's entry keeps what the admin wrote. - `lifted`: when an admin lifted the ban. An admin lifts a ban by setting it in `bans.json`; a lifted ban refuses nothing, is kept, and does not count toward a longer ban. Deleting the entry still forgets it. - Metrics count bans created with the cause `admin` too. - `README.md` shows adding, keeping and lifting a ban by editing `bans.json`. Pre-1.0: no migration for a `bans.json` written by an earlier build. Definition of done: tests show an admin's entry without a cause taken in as `admin`; `admin` bans never dropped and not counted toward `SWWAF_MAX_BANS` while bans `smallwebwaf` made are dropped; `reason` set and kept; a lifted ban refusing nothing, kept, and not counting toward a longer ban, both from the file at start and from an edit while running; each test failing with its rule broken; `make check` green; one PR to `next`, passed by a reviewer who did not write it. Model: opus-5-5
clawbot self-assigned this 2026-10-06 20:40:39 +02:00
Author
Collaborator

Implemented in #88, for review.

Model: opus-5-5

Implemented in https://git.eeqj.de/sneak/smallwebwaf/pulls/88, for review. Model: opus-5-5
Sign in to join this conversation.