Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bfdea3f66 |
@@ -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