Skip to content

Commit a6e6bc2

Browse files
airweenzimmerle
authored andcommitted
Allow empty anchored variable to use
1 parent b392a1c commit a6e6bc2

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

src/anchored_variable.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void AnchoredVariable::append(const std::string &a, size_t offset,
110110

111111

112112
void AnchoredVariable::evaluate(std::vector<const VariableValue *> *l) {
113-
if (m_name.empty() || m_value.empty()) {
113+
if (m_name.empty()) {
114114
return;
115115
}
116116

@@ -121,9 +121,6 @@ void AnchoredVariable::evaluate(std::vector<const VariableValue *> *l) {
121121

122122

123123
std::string * AnchoredVariable::evaluate() {
124-
if (m_value.empty() == true) {
125-
return NULL;
126-
}
127124
return &m_value;
128125
}
129126

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"enabled":1,
4+
"version_min":300000,
5+
"title":"Testing Byte ranges :: OWASP CRS id:920200",
6+
"client":{
7+
"ip":"200.249.12.31",
8+
"port":123
9+
},
10+
"server":{
11+
"ip":"200.249.12.31",
12+
"port":80
13+
},
14+
"request":{
15+
"headers":{
16+
"Host":"localhost",
17+
"User-Agent":"curl/7.38.0",
18+
"Accept-Language":"en-us,en;q=0.5",
19+
"Accept":"*/*",
20+
"Keep-Alive":"300",
21+
"Range": "bytes=1-10,11-20,21-30,31-40,41-50,51-60"
22+
},
23+
"uri":"/",
24+
"method":"GET"
25+
},
26+
"response":{
27+
"headers":{
28+
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
29+
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
30+
"Content-Type":"text/html"
31+
},
32+
"body":[
33+
"no need."
34+
]
35+
},
36+
"expected":{
37+
"http_code":400
38+
},
39+
"rules":[
40+
"SecRuleEngine On",
41+
"SecDefaultAction \"phase:2,deny,block,status:400,log\"",
42+
"SecRule REQUEST_HEADERS:Range|REQUEST_HEADERS:Request-Range \"@rx ^bytes=(?:(?:\\d+)?\\-(?:\\d+)?\\s*,?\\s*){6}\" \"id:920200,phase:2,block,t:none,msg:'Range: Too many fields (6 or more)',logdata:'%{MATCHED_VAR}',tag:'application-multi',tag:'language-multi',tag:'platform-multi',tag:'attack-protocol',tag:'OWASP_CRS/PROTOCOL_VIOLATION/INVALID_HREQ',tag:'paranoia-level/2',ver:'OWASP_CRS/3.1.0',severity:'WARNING',chain",
43+
"SecRule REQUEST_BASENAME \"!@endsWith .pdf\" \"setvar:'tx.msg=%{rule.msg}',setvar:'tx.anomaly_score_pl2=+%{tx.warning_anomaly_score}',setvar:'tx.%{rule.id}-OWASP_CRS/PROTOCOL_VIOLATION/INVALID_HREQ-%{MATCHED_VAR_NAME}=%{MATCHED_VAR}'\""
44+
]
45+
}
46+
]
47+

0 commit comments

Comments
 (0)