Skip to content

Commit 3563667

Browse files
committed
Adds the missing regression tests for USERID
1 parent 758ecb5 commit 3563667

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
{
3+
"enabled":1,
4+
"version_min":300000,
5+
"title":"Testing setuid action",
6+
"expected":{
7+
"debug_log": "Saving variable: USER:score with value: 5"
8+
},
9+
"client":{
10+
"ip":"200.249.12.31",
11+
"port":123
12+
},
13+
"request":{
14+
"headers":{
15+
"Host":"localhost",
16+
"User-Agent":"curl/7.38.0",
17+
"Accept":"*/*",
18+
"User-Agent":"My sweet little browser",
19+
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
20+
},
21+
"uri":"/?key=value&key=other_value",
22+
"method":"GET"
23+
},
24+
"server":{
25+
"ip":"200.249.12.31",
26+
"port":80
27+
},
28+
"rules":[
29+
"SecRuleEngine On",
30+
"SecDebugLog \/tmp\/modsec_debug.log",
31+
"SecRule REQUEST_HEADERS:User-Agent \"^(.*)$\" \"id:'900018',phase:1,t:none,t:sha1,t:hexEncode,setuid:%{REQUEST_COOKIES:USER}%,nolog,pass\"",
32+
"SecRule REQUEST_HEADERS \".*\" \"id:'900021',phase:1,setvar:USER.score=+10\"",
33+
"SecRule REQUEST_HEADERS:User-Agent \"^(.*)$\" \"id:'900068',phase:1,t:none,t:sha1,t:hexEncode,setsid:%{REQUEST_COOKIES:PHPSESSID}2,nolog,pass\"",
34+
"SecRule REQUEST_HEADERS \".*\" \"id:'900022',phase:1,setvar:USER.score=+5\""
35+
]
36+
}
37+
]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[
2+
{
3+
"enabled":1,
4+
"version_min":300000,
5+
"title":"Testing USERID variable (1/2)",
6+
"expected":{
7+
"debug_log": "Target value: \"zimmerle2\""
8+
},
9+
"client":{
10+
"ip":"200.249.12.31",
11+
"port":123
12+
},
13+
"request":{
14+
"headers":{
15+
"Host":"localhost",
16+
"User-Agent":"curl/7.38.0",
17+
"Accept":"*/*",
18+
"User-Agent":"My sweet little browser",
19+
"Cookie": "USER=zimmerle"
20+
},
21+
"uri":"/?key=value&key=other_value",
22+
"method":"GET"
23+
},
24+
"server":{
25+
"ip":"200.249.12.31",
26+
"port":80
27+
},
28+
"rules":[
29+
"SecRuleEngine On",
30+
"SecDebugLog \/tmp\/modsec_debug.log",
31+
"SecRule REQUEST_HEADERS:User-Agent \"^(.*)$\" \"id:'900018',phase:1,t:none,t:sha1,t:hexEncode,setuid:%{REQUEST_COOKIES:USER}%,nolog,pass\"",
32+
"SecRule REQUEST_HEADERS:User-Agent \"^(.*)$\" \"id:'900068',phase:1,t:none,t:sha1,t:hexEncode,setuid:%{REQUEST_COOKIES:USER}2,nolog,pass\"",
33+
"SecRule USERID \".*\" \"id:1239,phase:1,log,pass\""
34+
]
35+
},
36+
{
37+
"enabled":1,
38+
"version_min":300000,
39+
"title":"Testing USERID variable (2/2)",
40+
"expected":{
41+
"debug_log": "Target value: \"whee\""
42+
},
43+
"client":{
44+
"ip":"200.249.12.31",
45+
"port":123
46+
},
47+
"request":{
48+
"headers":{
49+
"Host":"localhost",
50+
"User-Agent":"curl/7.38.0",
51+
"Accept":"*/*",
52+
"User-Agent":"My sweet little browser",
53+
"Cookie": "USER=whee"
54+
},
55+
"uri":"/?key=value&key=other_value",
56+
"method":"GET"
57+
},
58+
"server":{
59+
"ip":"200.249.12.31",
60+
"port":80
61+
},
62+
"rules":[
63+
"SecRuleEngine On",
64+
"SecDebugLog \/tmp\/modsec_debug.log",
65+
"SecRule REQUEST_HEADERS:User-Agent \"^(.*)$\" \"id:'900018',phase:1,t:none,t:sha1,t:hexEncode,setuid:%{REQUEST_COOKIES:USER}%,nolog,pass\"",
66+
"SecRule USERID \".*\" \"id:1239,phase:1,log,pass\""
67+
]
68+
}
69+
]

0 commit comments

Comments
 (0)