1 ### Tests for rule exceptions
6 comment => "SecRuleRemoveById (single)",
9 SecDebugLog $ENV{DEBUG_LOG}
11 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1"
15 -error => [ qr/ModSecurity: /, 1 ],
16 -audit => [ qr/./, 1 ],
17 debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ],
18 -debug => [ qr/Access denied/, 1 ],
23 request => new HTTP::Request(
24 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
29 comment => "SecRuleRemoveById (multiple)",
32 SecDebugLog $ENV{DEBUG_LOG}
34 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1"
35 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:2"
36 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:3"
37 SecRuleRemoveById 1 2 3
40 -error => [ qr/ModSecurity: /, 1 ],
41 -audit => [ qr/./, 1 ],
42 debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ],
43 -debug => [ qr/Access denied/, 1 ],
48 request => new HTTP::Request(
49 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
54 comment => "SecRuleRemoveById (range)",
57 SecDebugLog $ENV{DEBUG_LOG}
59 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1"
60 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:2"
61 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:3"
65 -error => [ qr/ModSecurity: /, 1 ],
66 -audit => [ qr/./, 1 ],
67 debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ],
68 -debug => [ qr/Access denied/, 1 ],
73 request => new HTTP::Request(
74 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
79 comment => "SecRuleRemoveById (multiple + range)",
82 SecDebugLog $ENV{DEBUG_LOG}
84 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1"
85 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:2"
86 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:3"
87 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:4"
88 SecRuleRemoveById 1 2-4
91 -error => [ qr/ModSecurity: /, 1 ],
92 -audit => [ qr/./, 1 ],
93 debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ],
94 -debug => [ qr/Access denied/, 1 ],
99 request => new HTTP::Request(
100 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
107 comment => "SecRuleRemoveByMsg",
110 SecDebugLog $ENV{DEBUG_LOG}
112 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1,msg:'testing rule'"
113 SecRuleRemoveByMsg "testing rule"
116 -error => [ qr/ModSecurity: /, 1 ],
117 -audit => [ qr/./, 1 ],
118 debug => [ qr/Starting phase REQUEST_HEADERS\..*This phase consists of 0 rule.*Starting phase RESPONSE_HEADERS\./s, 1 ],
119 -debug => [ qr/Access denied/, 1 ],
124 request => new HTTP::Request(
125 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
129 # SecRuleUpdateActionById
132 comment => "SecRuleUpdateActionById",
135 SecDebugLog $ENV{DEBUG_LOG}
137 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1,msg:'testing rule'"
138 SecRuleUpdateActionById 1 "pass,nolog"
141 -error => [ qr/ModSecurity: /, 1 ],
142 -audit => [ qr/./, 1 ],
143 debug => [ qr/id:1,.*,pass,nolog/, 1 ],
144 -debug => [ qr/Access denied/, 1 ],
149 request => new HTTP::Request(
150 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
155 comment => "SecRuleUpdateActionById (chain)",
158 SecDebugLog $ENV{DEBUG_LOG}
160 SecRule REQUEST_URI "test" "phase:1,deny,status:500,id:1,msg:'testing rule',chain"
162 SecRuleUpdateActionById 1 "pass,nolog"
165 -error => [ qr/ModSecurity: /, 1 ],
166 -audit => [ qr/./, 1 ],
167 debug => [ qr/id:1,.*,pass,nolog/, 1 ],
168 -debug => [ qr/Access denied/, 1 ],
173 request => new HTTP::Request(
174 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt?foo=bar",