Files
openwaf/scripts
Pavlo Ratushnyi c97c7a1866 An exemption the edge had stopped honouring was still listed as an exemption, and the listing had no ceiling at all
Measured on the shipped image (openwaf:c28, the head tree), one allow entry
written for one minute against an operator block on the same address:

  03:58:16  POST /admin-api/allow {"match":"192.168.65.1","expiresInMinutes":1} -> 204
  03:58:20  GET /whatever -> 502   (passed to the upstream: the exemption is in force)
  03:59:38  GET /whatever -> 301   (the minute has passed; the block is back)
  03:59:39  GET /admin-api/allow -> 200, the row still listed, no liveness field
            GET /admin-api/state -> "allowEntries":1

The engine was right and the surface was wrong: the operator's table said
"exempted" a minute after the edge stopped honouring it, and the pill's number
was a count of rows rather than a count of exemptions in force. Nothing prunes
those rows either — retention ages out observations, engine bans and alerts, and
an operator's own writes are not the machine's to delete — so the dead ones
accumulate exactly where they cannot be told apart from the live ones.

The same endpoint was also the last listing with no ceiling: 1,101 rows came back
in 130,386 bytes with no X-Total-Count and no X-Truncated, and every paging
parameter was ignored — ?limit=10, ?offset=1000, ?limit=0 and ?limit=100000 each
answered all 1,101.

Now: GET /admin-api/allow takes live (default true, live=false means "do not
filter", the same shape as /blocks), limit 1..2000 and offset, refuses a limit
nobody meant by name, and carries X-Total-Count and X-Truncated computed from the
same predicate as the rows. Each row carries live, computed from the same rule
the engine applies (AllowEntry.IsLive), and /state answers allowEntries as the
live count with allowEntriesExpired beside it. The page fetches live=false, marks
a dead row "EXPIRED, the edge no longer honours it", counts them under the table,
and its pill says "0 live - 1 expired".

Teeth, in this order: AllowListingHonestyTests (4) written first and run against
the unfixed tree — 4 failed, 0 passed, including "allowEntries expected 1, got 2"
and "X-Total-Count expected 5, got null". The wire assertions in the second test
passed before the fix and after it: the engine already knew. The console gate
seeds an allow entry with a one-minute TTL ahead of the waits it already pays, so
the expired state arrives for free, and asserts the dead row is listed and marked,
the live one is not, and the line under the table counts them; the two existing
row deletes are now aimed at a match instead of clicking the first remove button,
which with a second row in the table would have deleted whatever sorted first.

Numbers on this tree: host — build 0 warnings, unit 128/128, integration 113/113,
smoke 22 passed / 0 failed, compose 47 passed / 0 failed, console 50 assertions /
0 failed, image 261 MB. Linux rehearsal, each stage on its own — source in
mcr.microsoft.com/dotnet/sdk:10.0 (Ubuntu 24.04.5, SDK 10.0.401): unit 128/128,
integration 113/113, smoke 22/0; compose in docker:cli: 47/0, enforcement lag
11 ms; console in mcr.microsoft.com/playwright:v1.63.0-noble: 50/0.
2026-10-02 06:16:59 +02:00
..