waf: refuse request lines and header lines over 8 KiB first (closes #339)
check / check (push) Successful in 5m59s

The header limits now also refuse a request line over 8 KiB with 414
(action request_line_too_long) and a header line over 8 KiB, Host
included, with 431. Like the other header limits they are fixed, run
first and make no ban. One long query string or cookie no longer keeps
the Core Rule Set busy for a third of a second.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-13 19:09:40 +00:00
1 parent 50c50bfcae
commit 832a7e6fe6
10 files changed
+221 -40

No files matched your search

+6 -1
View File
@@ -1690,7 +1690,12 @@ func TestALargeBodyAnnouncedAndLongHeadersAreNoReasonToRefuse(t *testing.T) {
strings.NewReader("a body"))
req.Header.Set(waf.ContentLengthHeader, "1073741824")
req.Header.Set(forwardedFor, otherClient)
req.Header.Set("X-Long", strings.Repeat("x", 40<<10))
// 40,000 bytes of headers, over rproxy's 32 KiB, in lines within the
// header limits.
for i := range 5 {
req.Header.Set("X-Long-"+strconv.Itoa(i), strings.Repeat("x", 8000))
}
got := do(t, req)
wantDisposition(t, got, http.StatusOK, waf.DispositionAllow)