waf: run the trap paths, rule files and Core Rule Set during the GeoJS wait (closes #405) #408

Merged
clawbot merged 5 commits from issue-405-decide-beside-lookup into next 2026-11-17 06:11:53 +01:00
Collaborator

Closes #405

While the lookup waits for GeoJS, the trap paths, the rule files and the Core Rule Set now run at the same time as the checks after the lookup. What they find is applied only once waf takes it, so a dropped side leaves no trace. They have 500 ms; past it the request gets 503, action checks_timed_out, with no ban and no offence.

What the diff does not show:

  • Params.CoreRuleSet is now an interface, so tests can hand in a stand-in.
  • newWAFWith lifts the 500 ms for every test: under the race detector, real inspections in existing tests took over 500 ms. The new tests set it back and use the stand-in.

Inspection time, slowest recorded request, paranoia level 4, 8 KiB of body read:

  • 131 ms with no load of mine (drupal POST /admin/config/people/accounts); other sessions kept about 17 of 48 cores busy;
  • 411 ms with all 48 cores inspecting (a mediawiki edit POST).

Both are under 500 ms. The margin with every core busy is small.

Judgement calls:

  • A lookup that needs no wait (lookup database, kept answer, no wait needed) runs its checks before the three start. The result never depends on goroutine order, and no inspection starts for a request the rate limits refuse.
  • The GeoJS wait runs to its end even after an early answer. Otherwise the client would be marked as having gone without an answer.
  • A request refused by the three before GeoJS answers has no AS number or country in its log line.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/smallwebwaf/issues/405 While the lookup waits for GeoJS, the trap paths, the rule files and the Core Rule Set now run at the same time as the checks after the lookup. What they find is applied only once `waf` takes it, so a dropped side leaves no trace. They have 500 ms; past it the request gets `503`, action `checks_timed_out`, with no ban and no offence. What the diff does not show: - `Params.CoreRuleSet` is now an interface, so tests can hand in a stand-in. - `newWAFWith` lifts the 500 ms for every test: under the race detector, real inspections in existing tests took over 500 ms. The new tests set it back and use the stand-in. Inspection time, slowest recorded request, paranoia level 4, 8 KiB of body read: - 131 ms with no load of mine (drupal `POST /admin/config/people/accounts`); other sessions kept about 17 of 48 cores busy; - 411 ms with all 48 cores inspecting (a mediawiki edit `POST`). Both are under 500 ms. The margin with every core busy is small. Judgement calls: - A lookup that needs no wait (lookup database, kept answer, no wait needed) runs its checks before the three start. The result never depends on goroutine order, and no inspection starts for a request the rate limits refuse. - The GeoJS wait runs to its end even after an early answer. Otherwise the client would be marked as having gone without an answer. - A request refused by the three before GeoJS answers has no AS number or country in its log line. Model: opus-5-5
clawbot added the needs-review label 2026-11-17 05:29:59 +01:00
clawbot self-assigned this 2026-11-17 05:29:59 +01:00
clawbot added 1 commit 2026-11-17 05:29:59 +01:00
While the lookup waits for GeoJS, the trap paths, the rule files and the
Core Rule Set run at the same time as the checks after the lookup. The
first side to refuse answers the request; what the other side finds leaves
no trace. Those three checks have 500 ms together: past it, the request is
refused with 503 as checks_timed_out, with no ban and no offence.

Tests hold GeoJS and the Core Rule Set with stand-ins under synctest. The
test helper lifts the 500 ms limit for tests that run the real Core Rule
Set, which the race detector slows past it.

Model: opus-5-5
clawbot added 4 commits 2026-11-17 05:50:28 +01:00
The method that runs the heuristics of afterLookup was named afterLookUp,
beside the list afterLookup() in the same package. It is now
runAfterLookup, like runBesideLookup.

Model: opus-5-5
The list that runs tag_deny the second time was named last(). The bare
word does not say what it holds or when it runs, a local variable in
rulefiles.go shadows it, and its doc read "the heuristics of last run".
It is now afterBesideLookup, beside the other lists named for when they
run.

Model: opus-5-5
"Answering in time" said waf refuses the slowest request a visitor can
send after 500 milliseconds. Its inspection takes under a second, which
can be under 500 milliseconds, and then it is not refused.

Model: opus-5-5
The comment on WouldAction lists every action observe mode can log as
would_action, and left out ActionChecksTimedOut, which this change adds.

Model: opus-5-5
Author
Collaborator

Verdict: PASS
Head: 098bbe8878

The change meets the definition of done of #405 and the repo's policies.

Model: opus-5-5

Verdict: PASS Head: 098bbe887854eaca28527196c2774a60f0a5cba7 The change meets the definition of done of https://git.eeqj.de/sneak/smallwebwaf/issues/405 and the repo's policies. Model: opus-5-5
Author
Collaborator

Verdict: PASS
Head: fde9b9c0b8

The change meets the definition of done of #405 and the policies of the repo and of sneak/prompts.

Model: opus-5-5

Verdict: PASS Head: fde9b9c0b8d46cb4e5e1eb95b0eaf70175279d2f The change meets the definition of done of https://git.eeqj.de/sneak/smallwebwaf/issues/405 and the policies of the repo and of `sneak/prompts`. Model: opus-5-5
clawbot merged commit 8c9f20d346 into next 2026-11-17 06:11:53 +01:00
Sign in to join this conversation.