Core Rule Set tests: WordPress's recorded requests go through the shared check (closes #284)
check / check (push) Failing after 3m14s
check / check (push) Failing after 3m14s
WordPress's recorded requests now go through wantRecordedRequestsPass, so a request with no body but a Content-Type is also inspected while bodies are read, as every other app's is. The seven such requests, wp-cron.php's, pass; wordpress.conf is unchanged. Model: opus-5-5
This commit is contained in:
1 parent
2ac7f1ccbf
commit
2bfdea3f66
1 file changed
+2
-20
@@ -841,28 +841,10 @@ func TestOrdinaryWordPressRequestsPassAndAttacksAreRefused(t *testing.T) {
|
|||||||
|
|
||||||
const threshold = 5 // SWW_WAF_ANOMALY_THRESHOLD's default
|
const threshold = 5 // SWW_WAF_ANOMALY_THRESHOLD's default
|
||||||
|
|
||||||
|
wantRecordedRequestsPass(t, "wordpress-requests.txt")
|
||||||
|
|
||||||
defaults, bodies := atDefaults(t), readingBodiesUpTo64K(t)
|
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, attack := range []string{
|
for _, attack := range []string{
|
||||||
sqlInjection,
|
sqlInjection,
|
||||||
"..%2F..%2Fwp-config.php",
|
"..%2F..%2Fwp-config.php",
|
||||||
|
|||||||
Reference in new issue
Block a user