Files
openwaf/scripts
Pavlo Ratushnyi 4280ebb2ca a request budget says who it is pausing, and one source can be let out
The budget listing has carried three numbers per budget since OPEN-68 — sources
counted, windows running, over budget now — and no name. "3 over budget" is the
half an operator cannot act on, and the only lever for one of those three was
`DELETE /admin-api/rate-rules/{id}`: take the budget off every source on the site
to release one office behind one NAT. The edge-wide budget never had this hole,
because /admin-api/rate names its sources.

  * GET /admin-api/rate-rules/{id}/sources — who this budget is inside right now:
    sourceKey, count against the limit, when the window ends and how many seconds
    are left, overBudget. Busiest first, live windows only, paged with
    X-Total-Count / X-Truncated like every other listing. `total` is the same
    number the listing's `liveWindows` reports and the over-budget count matches
    `overBudgetNow`: the names come from the same state as the three counters,
    not from a second ledger.
  * DELETE /admin-api/rate-rules/{id}/sources?source=<key> — drop one source's
    window on one budget. Not an exemption, and the answer says so: the window
    restarts at zero and the budget counts this source again from there, while
    every other source stays paused. An operator who types an address gets the
    key this edge files it under, and the answer names the key it dropped,
    because the others sharing it are still paused. A second clear answers
    `cleared: false` and writes no second record; the first is in the change log
    under `rate rule / changed`.
  * Console: a `who` button per budget row, and a `let out` button per source.

Rulings kept: the entries are source keys with the prefix rule printed beside
them (a /24 in the list is the point, not a bug); the limit is passed in from the
rule row rather than copied into the counter, so one number is enforced once;
reading spends nothing, so the page that exists to show a pause cannot cause one;
an empty list says which kind of empty it is — "counting, nobody inside a window"
and "this budget has expired" are different answers; and the read-only token gets
a 403 on the clear, not a 401, because the token is known and its level is the
answer.

What the run caught, on this tree: two console scenes failed with `answered 403`
because the gate's own probes are refusals and the streak pillar had banned the
probe addresses — a correct edge, and a scene that cannot retry past a one-hour
ban. Both now clear that one ban by name, leaving the engine bans the netblock
scene reads standing. The first run of the feature also caught the clear
reporting `cleared: false` after actually dropping the window: the derived-key
branch dropped the state and never set the flag.

build 0 warnings / 0 errors, unit 377/377, integration 365/365 in 31 s,
console 129 assertions / 0 failed, smoke passed 202 / failed 0, compose 317
passed / 0 failed against the built image at 262 MB.

Refs OPEN-71.
2026-10-05 10:13:29 +02:00
..