waf: one Cookie line, and a 500 ms GeoJS wait (closes #401)
check / check (push) Failing after 14m7s

A browser sends all its cookies on one Cookie line (RFC 6265), and Go's
server joins HTTP/2 Cookie lines into one, so waf now refuses a second
line with 431. Further lines only gave a visitor more bytes for the Core
Rule Set to read. The refusal logs cookie_lines and cookie_lines_limit.

The default of SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS drops from 800
to 500 milliseconds, so the Core Rule Set's share of rproxy's 2 seconds
grows from 1 to 1.3 seconds. The slowest worst-case request takes about
0.84 seconds of processor time with every core busy.

Model: opus-5-5
This commit is contained in:
clawbot authored and sneak committed 2026-11-16 22:15:13 +00:00
1 parent 988f117ef3
commit 01a8a7aa08
9 files changed
+68 -47

No files matched your search

+12 -7
View File
@@ -2405,12 +2405,12 @@ The Core Rule Set inspects the body a question carries only while
`rproxy` stops waiting for `waf` after `SWW_RPROXY_WAF_BACKEND_TIMEOUT_MS`, by
default 2 seconds, and `SWW_RPROXY_WAF_BACKEND_NO_ANSWER_DISPOSITION` then
decides. The longest a question waits on an outside source is
`SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS`, by default 800 milliseconds, well
`SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS`, by default 500 milliseconds, well
within that time.
GeoJS is the only outside source a question can wait on. A question waits only
when step 6 says so, and for at most
`SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS`, by default 800 milliseconds. A
`SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS`, by default 500 milliseconds. A
client without an answer by then counts as unknown. No question waits on these,
which run in the background:
@@ -2451,8 +2451,11 @@ It refuses a request with `431` for any of:
- a header line longer than 8 KiB. Each value of a header sent twice is a line
of its own. `Host` counts as a line.
- more than 50 cookies. Each part of its `Cookie` headers between semicolons
counts as one, unless it is empty or only spaces and tabs.
- more than one `Cookie` line. A browser sends all its cookies on one line, as
RFC 6265 requires. Go's server joins the `Cookie` lines of an HTTP/2 request
into one before `rproxy` sees them.
- more than 50 cookies. Each part of its `Cookie` line between semicolons counts
as one, unless it is empty or only spaces and tabs.
- more than 100 header fields. A header sent twice counts twice. `Host` and
`Transfer-Encoding` do not count. `X-Request-ID` and `X-Forwarded-Proto` do.
@@ -2490,9 +2493,11 @@ body can add up to more than the body. From 1 KiB of JSON, Coraza makes at most
A request can reach all of these at once. At paranoia level 4, with no rule
switched off, the Core Rule Set takes under a second on one core of a current
server to inspect it. So `waf` answers it within the default 2 seconds, even
after the default 800 milliseconds of waiting for GeoJS. Enough such requests at
once can still overload `waf` past `SWW_RPROXY_WAF_BACKEND_TIMEOUT_MS`.
server to inspect it, even with every core busy. Its share of the default 2
seconds is 1.3 seconds: the rest is the default 500 milliseconds of waiting for
GeoJS and 200 milliseconds for the other checks. So `waf` answers it in time.
Enough such requests at once can still overload `waf` past
`SWW_RPROXY_WAF_BACKEND_TIMEOUT_MS`.
### The report