mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Fix parser error while dealing with operator negation
This patch closes the issue #960
This commit is contained in:
parent
47a62b98bb
commit
e0926fee37
@ -109,9 +109,9 @@ Operator *Operator::instantiate(std::string op_string) {
|
|||||||
std::string param = "";
|
std::string param = "";
|
||||||
if (op.find(" ") != std::string::npos) {
|
if (op.find(" ") != std::string::npos) {
|
||||||
param = op;
|
param = op;
|
||||||
param.erase(0, op_string.find(" "));
|
param.erase(0, param.find(" ") + 1);
|
||||||
op.erase(op_string.find(" "),
|
op.erase(op.find(" "),
|
||||||
op_string.length() - op_string.find(" "));
|
op.length() - op.find(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::basic_string<char>::iterator p = op.begin();
|
for (std::basic_string<char>::iterator p = op.begin();
|
||||||
|
@ -174,7 +174,7 @@ VAR_FREE_TEXT_SPACE_COMMA [^, \t\"]+
|
|||||||
VAR_FREE_TEXT_SPACE [^ \t\"]+
|
VAR_FREE_TEXT_SPACE [^ \t\"]+
|
||||||
|
|
||||||
|
|
||||||
SOMETHING ["]{1}[^@]{1}([^"]|([^\\"]\\\"))*["]{1}
|
SOMETHING ["]{1}[^@|!]{1}([^"]|([^\\"]\\\"))*["]{1}
|
||||||
|
|
||||||
CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
|
CONFIG_DIR_UNICODE_MAP_FILE (?i:SecUnicodeMapFile)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expected":{
|
"expected":{
|
||||||
"debug_log":"Executing operator \"@contains \" with param \"config_example2\" against ARGS."
|
"debug_log":"Executing operator \"@contains\" with param \"config_example2\" against ARGS."
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
@ -73,7 +73,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expected":{
|
"expected":{
|
||||||
"debug_log":"Executing operator \"@contains \" with param \"config_example\" against ARGS."
|
"debug_log":"Executing operator \"@contains\" with param \"config_example\" against ARGS."
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
@ -115,7 +115,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expected":{
|
"expected":{
|
||||||
"debug_log":"Executing operator \"@contains \" with param \"config_example2\" against ARGS."
|
"debug_log":"Executing operator \"@contains\" with param \"config_example2\" against ARGS."
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
@ -157,7 +157,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expected":{
|
"expected":{
|
||||||
"debug_log":"Executing operator \"@contains \" with param \"test\" against ARGS."
|
"debug_log":"Executing operator \"@contains\" with param \"test\" against ARGS."
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
@ -199,7 +199,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expected":{
|
"expected":{
|
||||||
"debug_log":"Executing operator \"@contains \" with param \"config_example2\" against ARGS."
|
"debug_log":"Executing operator \"@contains\" with param \"config_example2\" against ARGS."
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
@ -242,7 +242,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expected":{
|
"expected":{
|
||||||
"debug_log":"Executing operator \"@contains \" with param \"test\" against ARGS."
|
"debug_log":"Executing operator \"@contains\" with param \"test\" against ARGS."
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expected":{
|
"expected":{
|
||||||
"debug_log":"Executing operator \"@pmfromfile \" with param \"https://www.modsecurity.org/modsecurity-regression-test.txt\" against REQUEST_FILENAME"
|
"debug_log":"Executing operator \"@pmfromfile\" with param \"https://www.modsecurity.org/modsecurity-regression-test.txt\" against REQUEST_FILENAME"
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
@ -88,7 +88,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expected":{
|
"expected":{
|
||||||
"debug_log":"Executing operator \"@contains \" with param \"somethingelse\" against ARGS."
|
"debug_log":"Executing operator \"@contains\" with param \"somethingelse\" against ARGS."
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"title":"Testing action :: SecRule directives should be case insensitive",
|
"title":"Testing action :: SecRule directives should be case insensitive",
|
||||||
"expected":{
|
"expected":{
|
||||||
"audit_log":"",
|
"audit_log":"",
|
||||||
"debug_log":"Executing operator \"@contains \" with param \"PHPSESSID\" against REQUEST_HEADERS.",
|
"debug_log":"Executing operator \"@contains\" with param \"PHPSESSID\" against REQUEST_HEADERS.",
|
||||||
"error_log":""
|
"error_log":""
|
||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user