Skip to content

Commit 86787f2

Browse files
author
Felipe Zimmerle
committed
Adds SecRemoteRules regression tests.
Added two test cases for SecRemoteRules. Contents are loaded from https://www.modsecurity.org
1 parent b5398ab commit 86787f2

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
### SecRemoteRules
2+
3+
{
4+
type => "misc",
5+
comment => "SecRemoteRules load",
6+
conf => qq(
7+
SecRuleEngine On
8+
SecDebugLog $ENV{DEBUG_LOG}
9+
SecDebugLogLevel 9
10+
SecRequestBodyAccess On
11+
SecRemoteRules 123 "https://www.modsecurity.org/modsecurity-regression-test-secremoterules.txt"
12+
),
13+
match_log => {
14+
error => [ qr/ModSecurity: Loaded 1 rule/, 1],
15+
},
16+
},
17+
{
18+
type => "misc",
19+
comment => "SecRemoteRules apply some remote rules",
20+
conf => qq(
21+
SecRuleEngine On
22+
SecDebugLog $ENV{DEBUG_LOG}
23+
SecDebugLogLevel 9
24+
SecRequestBodyAccess On
25+
SecRemoteRules 123 "https://www.modsecurity.org/modsecurity-regression-test-secremoterules.txt"
26+
),
27+
match_log => {
28+
error => [ qr/ModSecurity: Warning. Matched phrase \"127.0.0.1\" at REQUEST_FILENAME./, 1],
29+
debug => [ qr/Matched phrase \"127.0.0.1\" at REQUEST_FILENAME/, 1 ],
30+
},
31+
match_response => {
32+
status => qr/^404$/,
33+
},
34+
request => new HTTP::Request(
35+
POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/127.0.0.1.html",
36+
[
37+
"Content-Type" => "application/x-www-form-urlencoded",
38+
],
39+
# Args
40+
"some_variable=-1' and 1=1 union/* foo */select load_file('/etc/passwd')--"
41+
),
42+
},
43+

0 commit comments

Comments
 (0)