waf: decide every visitor request within rproxy's timeout (closes #394)
check / check (push) Successful in 6m36s
check / check (push) Successful in 6m36s
The Core Rule Set is the one check whose time a visitor can stretch. At paranoia level 4 it took over 2 s on a request with an 8 KiB request line, three 8 KiB Cookie lines and a 64 KiB form body. SWW_WAF_CORE_RULE_SET_BODY_INSPECTION_SIZE now takes at most 8K, which brings that request under 1 s. A test per kind of input times the Core Rule Set on the worst request within the limits, at the slowest settings. SPEC.md lists the limits that bound it. Model: opus-5-5
This commit is contained in:
1 parent
23788920f7
commit
7a627f44e1
9 files changed
+411
-63
No files matched your search
@@ -1787,7 +1787,7 @@ func TestCoreRuleSetReadsTheBodyAQuestionCarries(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
s := startWAF(t, "", map[string]string{
|
||||
coreRuleSetMode: block, coreRuleSetBodyInspectionSize: "64K",
|
||||
coreRuleSetMode: block, coreRuleSetBodyInspectionSize: "8K",
|
||||
})
|
||||
|
||||
ask := func(contentType, body string) answer {
|
||||
@@ -1802,10 +1802,10 @@ func TestCoreRuleSetReadsTheBodyAQuestionCarries(t *testing.T) {
|
||||
got := ask(formData, "id=1'%20OR%20'1'='1")
|
||||
wantDisposition(t, got, http.StatusForbidden, waf.DispositionDeny)
|
||||
|
||||
// The first 64 KiB of a longer JSON body cannot be parsed, which is no
|
||||
// The first 8 KiB of a longer JSON body cannot be parsed, which is no
|
||||
// attack, so the Core Rule Set does not read it.
|
||||
cut := `{"text":"` + strings.Repeat("x", waf.QuestionBodyMaxBytes)
|
||||
got = ask("application/json", cut[:waf.QuestionBodyMaxBytes])
|
||||
cut := `{"text":"` + strings.Repeat("x", 8<<10)
|
||||
got = ask("application/json", cut)
|
||||
wantDisposition(t, got, http.StatusOK, waf.DispositionAllow)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user