Skip to content

Commit bc95a9b

Browse files
test: add issue-3505 regression tests for ctl:ruleRemoveTargetById regex
- 2 test cases: JSON array keys, mixpanel suffix (SecRuleUpdateTargetById parity) - Expected to fail until regex support is implemented - OODA baseline: Test 1 parse error, Test 2 HTTP 403 (exclusion not applied) Made-with: Cursor
1 parent 5bdfcbf commit bc95a9b

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
[
2+
{
3+
"enabled": 1,
4+
"version_min": 300000,
5+
"title": "Issue 3505: ctl:ruleRemoveTargetById with regex - JSON array keys",
6+
"client": {
7+
"ip": "200.249.12.31",
8+
"port": 123
9+
},
10+
"server": {
11+
"ip": "200.249.12.31",
12+
"port": 80
13+
},
14+
"request": {
15+
"headers": {
16+
"Host": "localhost",
17+
"User-Agent": "curl/7.38.0",
18+
"Accept": "*/*",
19+
"Content-Type": "application/json",
20+
"Content-Length": "35"
21+
},
22+
"uri": "/api/jobs",
23+
"method": "POST",
24+
"body": [
25+
"[{\"JobDescription\":\"javascript\"}]"
26+
]
27+
},
28+
"response": {
29+
"headers": {
30+
"Content-Length": "0"
31+
},
32+
"body": [
33+
""
34+
]
35+
},
36+
"expected": {
37+
"http_code": 200
38+
},
39+
"rules": [
40+
"SecRuleEngine On",
41+
"SecRule REQUEST_URI \"@beginsWith /api/jobs\" \"id:100100,phase:1,pass,nolog,ctl:ruleRemoveTargetById=932125;ARGS:/^json\\.\\d+\\.JobDescription$/\"",
42+
"SecRule ARGS \"@rx (?i:script)\" \"id:932125,phase:2,deny,status:403,log,tag:'XSS'\""
43+
]
44+
},
45+
{
46+
"enabled": 1,
47+
"version_min": 300000,
48+
"title": "Issue 3505: ctl:ruleRemoveTargetById with regex - mixpanel suffix (parity with SecRuleUpdateTargetById)",
49+
"client": {
50+
"ip": "200.249.12.31",
51+
"port": 123
52+
},
53+
"server": {
54+
"ip": "200.249.12.31",
55+
"port": 80
56+
},
57+
"request": {
58+
"headers": {
59+
"Host": "localhost",
60+
"User-Agent": "curl/7.38.0",
61+
"Accept": "*/*",
62+
"Content-Length": "0"
63+
},
64+
"uri": "/?mixpanel=value&other=attack",
65+
"method": "GET",
66+
"body": [
67+
""
68+
]
69+
},
70+
"response": {
71+
"headers": {
72+
"Content-Length": "0"
73+
},
74+
"body": [
75+
""
76+
]
77+
},
78+
"expected": {
79+
"http_code": 200
80+
},
81+
"rules": [
82+
"SecRuleEngine On",
83+
"SecRule REQUEST_FILENAME \"@unconditionalMatch\" \"id:100,phase:1,pass,nolog,ctl:ruleRemoveTargetById=1;ARGS:/mixpanel$/\"",
84+
"SecRule ARGS \"@contains value\" \"id:1,phase:2,deny,status:403,tag:'test'\""
85+
]
86+
}
87+
]

test/test-suite.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ TESTS+=test/test-cases/regression/config-secdefaultaction.json
4444
TESTS+=test/test-cases/regression/config-secremoterules.json
4545
TESTS+=test/test-cases/regression/config-update-action-by-id.json
4646
TESTS+=test/test-cases/regression/config-update-target-by-id.json
47+
TESTS+=test/test-cases/regression/issue-3505.json
4748
TESTS+=test/test-cases/regression/config-update-target-by-msg.json
4849
TESTS+=test/test-cases/regression/config-update-target-by-tag.json
4950
TESTS+=test/test-cases/regression/config-xml_external_entity.json

0 commit comments

Comments
 (0)