Core Rule Set tests: check WordPress's recorded requests as the other apps' (closes #284)
check / check (push) Failing after 37s

TestOrdinaryWordPressRequestsPass skipped the inspection that reads
bodies for a request with no body, including one with a Content-Type.
It now calls wantRecordedRequestsPass.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-10 14:35:18 +00:00
1 parent f8d769fc17
commit d8fa244e73
1 file changed
+1 -25
+1 -25
View File
@@ -13,8 +13,6 @@ import (
"slices" "slices"
"strings" "strings"
"testing" "testing"
"sneak.berlin/go/smallwebwaf/internal/coreruleset"
) )
// giteaRequests returns the recorded ordinary gitea requests in testdata. // giteaRequests returns the recorded ordinary gitea requests in testdata.
@@ -178,27 +176,5 @@ func TestOrdinaryVaultwardenRequestsPass(t *testing.T) {
func TestOrdinaryWordPressRequestsPass(t *testing.T) { func TestOrdinaryWordPressRequestsPass(t *testing.T) {
t.Parallel() t.Parallel()
const threshold = 5 // SWW_WAF_ANOMALY_THRESHOLD's default wantRecordedRequestsPass(t, "wordpress-requests.txt")
defaults, bodies := atDefaults(t), readingBodiesUpTo64K(t)
for _, recorded := range recordedRequests(t, "wordpress-requests.txt") {
t.Run(recorded.Method+" "+recorded.Target, func(t *testing.T) {
t.Parallel()
r := request{recorded.Method, recorded.Target, recorded.Headers}
crsSets := []*coreruleset.CoreRuleSet{defaults}
if recorded.Body != "" {
crsSets = append(crsSets, bodies)
}
for _, crs := range crsSets {
got, _ := inspectBody(t, crs, r, recorded.Body)
if got.Score >= threshold {
t.Errorf("%s %s %.200q refused: %+v", r.method, r.target, recorded.Body, got)
}
}
})
}
} }