Skip to content

Commit f180e64

Browse files
authored
Merge pull request #3243 from eduar-hte/valid-hex-fix
Adjust reference to modsecurity::utils::string::VALID_HEX
2 parents 9403cf6 + a4604b6 commit f180e64

File tree

2 files changed

+78
-3
lines changed

2 files changed

+78
-3
lines changed

src/operators/pm.cc

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "src/utils/acmp.h"
2323
#include "src/utils/string.h"
2424

25+
using namespace modsecurity::utils::string;
2526

2627
static inline std::string parse_pm_content(const std::string &op_parm) {
2728
auto offset = op_parm.find_first_not_of(" \t");

test/test-cases/regression/operator-pm.json

+77-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"enabled": 1,
44
"version_min": 300000,
55
"version_max": 0,
6-
"title": "pm operator test 1/4",
6+
"title": "pm operator test 1/6",
77
"client": {
88
"ip": "200.249.12.31",
99
"port": 2313
@@ -77,7 +77,7 @@
7777
"enabled": 1,
7878
"version_min": 300000,
7979
"version_max": 0,
80-
"title": "pm operater test 3/4",
80+
"title": "pm operater test 3/6",
8181
"client": {
8282
"ip": "200.249.12.31",
8383
"port": 2313
@@ -114,7 +114,7 @@
114114
"enabled": 1,
115115
"version_min": 300000,
116116
"version_max": 0,
117-
"title": "pm operater test 4/4",
117+
"title": "pm operater test 4/6",
118118
"client": {
119119
"ip": "200.249.12.31",
120120
"port": 2313
@@ -146,5 +146,79 @@
146146
"SecRuleEngine On",
147147
"SecRule ARGS \"@pm a ` b\" \"phase:1,id:999,deny,status:500\""
148148
]
149+
},
150+
{
151+
"enabled": 1,
152+
"version_min": 300000,
153+
"version_max": 0,
154+
"title": "pm operater test 5/6",
155+
"client": {
156+
"ip": "200.249.12.31",
157+
"port": 2313
158+
},
159+
"server": {
160+
"ip": "200.249.12.31",
161+
"port": 80
162+
},
163+
"request": {
164+
"headers": {
165+
"Host": "net.tutsplus.com"
166+
},
167+
"uri": "\/test.pl?param1=123",
168+
"method": "GET",
169+
"http_version": 1.1,
170+
"body": ""
171+
},
172+
"response": {
173+
"headers": {
174+
"Content-Type": "text\/xml; charset=utf-8\n\r",
175+
"Content-Length": "length\n\r"
176+
}
177+
},
178+
"expected": {
179+
"debug_log": "Rule returned 1",
180+
"http_code": 403
181+
},
182+
"rules": [
183+
"SecRuleEngine On",
184+
"SecRule ARGS \"@pm 1 2 3\" \"phase:1,id:999,deny\""
185+
]
186+
},
187+
{
188+
"enabled": 1,
189+
"version_min": 300000,
190+
"version_max": 0,
191+
"title": "pm operater test 6/6",
192+
"client": {
193+
"ip": "200.249.12.31",
194+
"port": 2313
195+
},
196+
"server": {
197+
"ip": "200.249.12.31",
198+
"port": 80
199+
},
200+
"request": {
201+
"headers": {
202+
"Host": "net.tutsplus.com"
203+
},
204+
"uri": "\/test.pl?param1=abc",
205+
"method": "GET",
206+
"http_version": 1.1,
207+
"body": ""
208+
},
209+
"response": {
210+
"headers": {
211+
"Content-Type": "text\/xml; charset=utf-8\n\r",
212+
"Content-Length": "length\n\r"
213+
}
214+
},
215+
"expected": {
216+
"debug_log": "Rule returned 0",
217+
"http_code": 200
218+
},
219+
"rules": [
220+
"SecRuleEngine On",
221+
"SecRule ARGS \"@pm 1 2 3\" \"phase:1,id:999,deny\""
222+
]
149223
}
150224
]

0 commit comments

Comments
 (0)