Skip to content

Commit 065c2e6

Browse files
author
Felipe Zimmerle
committed
Adds test case for #1850
1 parent e1e8a01 commit 065c2e6

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ TESTS+=test/test-cases/regression/issue-1785.json
9191
TESTS+=test/test-cases/regression/issue-1812.json
9292
TESTS+=test/test-cases/regression/issue-1831.json
9393
TESTS+=test/test-cases/regression/issue-1844.json
94+
TESTS+=test/test-cases/regression/issue-1850.json
9495
TESTS+=test/test-cases/regression/issue-1725.json
9596
TESTS+=test/test-cases/regression/issue-1941.json
9697
TESTS+=test/test-cases/regression/variable-RESPONSE_HEADERS.json

test/test-cases/regression/actions.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"enabled": 1,
124124
"version_min": 300000,
125125
"version_max": 0,
126-
"title": "actions :: trim,status:500,redirect:http://www.google.com",
126+
"title": "actions :: trim,status:306,redirect:http://www.google.com",
127127
"client": {
128128
"ip": "200.249.12.31",
129129
"port": 2313
@@ -171,12 +171,12 @@
171171
"audit_log": "",
172172
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
173173
"error_log": "",
174-
"http_code": 500,
174+
"http_code": 306,
175175
"redirect_url": "http://www.google.com"
176176
},
177177
"rules": [
178178
"SecRuleEngine On",
179-
"SecRule ARGS \"@contains test\" \"id:1,t:trim,status:500,redirect:'http://www.google.com'\""
179+
"SecRule ARGS \"@contains test\" \"id:1,t:trim,status:306,redirect:'http://www.google.com'\""
180180
]
181181
},
182182
{
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[
2+
{
3+
"enabled": 1,
4+
"version_min": 209000,
5+
"version_max": -1,
6+
"title": "Override the default status code if not suitable to redirect action",
7+
"url": "https:\/\/github.com\/SpiderLabs\/ModSecurity\/issues\/1850",
8+
"client": {
9+
"ip": "200.249.12.31",
10+
"port": 2313
11+
},
12+
"server": {
13+
"ip": "200.249.12.31",
14+
"port": 80
15+
},
16+
"request": {
17+
"headers": {
18+
"Host": "net.tutsplus.com",
19+
"User-Agent": "",
20+
"Accept": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8",
21+
"Accept-Language": "en-us,en;q=0.5",
22+
"Accept-Encoding": "gzip,deflate",
23+
"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
24+
"Keep-Alive": "300",
25+
"Connection": "keep-alive",
26+
"Cookie": "PHPSESSID=r2t5uvjq435r4q7ib3vtdjq120",
27+
"Pragma": "no-cache",
28+
"Cache-Control": "no-cache"
29+
},
30+
"uri": "\/test.pl?foo=£&bar=%C2%A3",
31+
"method": "GET",
32+
"http_version": 1.1,
33+
"body": ""
34+
},
35+
"response": {
36+
"headers": {
37+
"Content-Type": "text\/xml; charset=utf-8\n\r",
38+
"Content-Length": "length\n\r"
39+
}
40+
},
41+
"expected": {
42+
"http_code": 302
43+
},
44+
"rules": [
45+
"SecRuleEngine On",
46+
"SecDefaultAction \"phase:1,status:404,deny\"",
47+
"SecRule REQUEST_URI \"@contains /\" \"id:2000001,phase:1,log,redirect:'http://1.1.1.1/failed.html',t:none,msg:\"Unauthorized administrator request'\""
48+
]
49+
}
50+
]

0 commit comments

Comments
 (0)