waf: a heuristic says itself that it refuses whatever the lookup answers (closes #446) #476

Merged
clawbot merged 1 commits from issue-446-refuses-without-lookup into next 2026-11-19 23:28:53 +01:00
Collaborator

closes #446

refusedWhateverTheAnswer names no heuristic now. It asks each heuristic of afterLookup that implements a new interface whether it will refuse the request whatever the lookup answers. blocklists and rateLimits implement it. The comment in heuristics.go on adding a heuristic names the interface. It also names the three places outside a heuristic's file that may change with it: waitForGeoJS, requestCanGetTag and findBesideLookup.

New names:

  • interface refusesWithoutLookup: a heuristic of afterLookup that can tell, before the lookup answers, that it will refuse a request whatever the answer;
  • method refusesWhateverTheLookupAnswers(rq, now) bool: whether the heuristic will refuse rq at now, whatever the lookup answers about its client. It changes nothing.

What the diff does not make obvious:

  • handler loses its blocklists and rateLimits fields. Only refusedWhateverTheAnswer read them, so both heuristics are now built inside the afterLookup list, like the others.
  • Behaviour is unchanged. blocklists comes before rate_limits in afterLookup, so they are asked in the same order as before. Observe mode still skips the wait for no request.

Judgement call: rateLimits.overAWholeRateLimit is renamed to the interface method, and its doc keeps the "whole rate limit" condition. blocklists keeps refusedByBlocklists, which check also uses, and adds the interface method as a one-line call to it.

Model: opus-5-5

closes https://git.eeqj.de/sneak/smallwebwaf/issues/446 `refusedWhateverTheAnswer` names no heuristic now. It asks each heuristic of `afterLookup` that implements a new interface whether it will refuse the request whatever the lookup answers. `blocklists` and `rateLimits` implement it. The comment in `heuristics.go` on adding a heuristic names the interface. It also names the three places outside a heuristic's file that may change with it: `waitForGeoJS`, `requestCanGetTag` and `findBesideLookup`. New names: - interface `refusesWithoutLookup`: a heuristic of `afterLookup` that can tell, before the lookup answers, that it will refuse a request whatever the answer; - method `refusesWhateverTheLookupAnswers(rq, now) bool`: whether the heuristic will refuse `rq` at `now`, whatever the lookup answers about its client. It changes nothing. What the diff does not make obvious: - `handler` loses its `blocklists` and `rateLimits` fields. Only `refusedWhateverTheAnswer` read them, so both heuristics are now built inside the `afterLookup` list, like the others. - Behaviour is unchanged. `blocklists` comes before `rate_limits` in `afterLookup`, so they are asked in the same order as before. Observe mode still skips the wait for no request. Judgement call: `rateLimits.overAWholeRateLimit` is renamed to the interface method, and its doc keeps the "whole rate limit" condition. `blocklists` keeps `refusedByBlocklists`, which `check` also uses, and adds the interface method as a one-line call to it. Model: opus-5-5
clawbot self-assigned this 2026-11-19 22:59:21 +01:00
clawbot added 1 commit 2026-11-19 22:59:21 +01:00
refusedWhateverTheAnswer asks each heuristic of afterLookup that
implements the new refusesWithoutLookup interface, instead of naming
blocklists and rate_limits. The comment on adding a heuristic names the
places outside its file that may change with it.

Model: opus-5-5
clawbot added the needs-review label 2026-11-19 22:59:21 +01:00
Author
Collaborator

Verdict: PASS
Head: 9d3f212b0d

refusedWhateverTheAnswer now asks the heuristics of afterLookup through refusesWithoutLookup, with the same behaviour and order as before, and the comment on adding a heuristic names the remaining places outside its file, as the definition of done in #446 asks.

Model: opus-5-5

Verdict: PASS Head: 9d3f212b0d63884d3a2c4458eaa9e2341d936a45 `refusedWhateverTheAnswer` now asks the heuristics of `afterLookup` through `refusesWithoutLookup`, with the same behaviour and order as before, and the comment on adding a heuristic names the remaining places outside its file, as the definition of done in https://git.eeqj.de/sneak/smallwebwaf/issues/446 asks. Model: opus-5-5
clawbot merged commit 9d008ed31a into next 2026-11-19 23:28:53 +01:00
Sign in to join this conversation.