mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 01:22:18 +03:00
Refactoring: Makes transformations to work with new execute signature
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 403
|
||||
},
|
||||
@@ -109,7 +109,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 302,
|
||||
"redirect_url": "http://www.google.com"
|
||||
@@ -169,7 +169,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 306,
|
||||
"redirect_url": "http://www.google.com"
|
||||
@@ -229,7 +229,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 500
|
||||
},
|
||||
@@ -288,7 +288,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 500
|
||||
},
|
||||
@@ -347,7 +347,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 500
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 403
|
||||
},
|
||||
@@ -97,7 +97,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 403
|
||||
},
|
||||
@@ -155,7 +155,7 @@
|
||||
},
|
||||
"expected": {
|
||||
"audit_log": "",
|
||||
"debug_log": "\\[9\\] Transformation t:trim: \"test",
|
||||
"debug_log": "\\[9\\] T \\(0\\) t:trim: \"test",
|
||||
"error_log": "",
|
||||
"http_code": 403
|
||||
},
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
},
|
||||
"expected":{
|
||||
"audit_log":"",
|
||||
"debug_log":"Transformation t:lowercase: \"test2\"",
|
||||
"debug_log":"T \\(0\\) t:lowercase: \"test2\"",
|
||||
"error_log":""
|
||||
},
|
||||
"rules":[
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
]
|
||||
},
|
||||
"expected":{
|
||||
"debug_log":"Transformation t:trim: \"no need.\""
|
||||
"debug_log":"T \\(0\\) t:trim: \"no need.\""
|
||||
},
|
||||
"rules":[
|
||||
"SecRuleEngine On",
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
]
|
||||
},
|
||||
"expected":{
|
||||
"debug_log":"Transformation t:trim: \"small_text_file"
|
||||
"debug_log":"T \\(0\\) t:trim: \"small_text_file"
|
||||
},
|
||||
"rules":[
|
||||
"SecRuleEngine On",
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
]
|
||||
},
|
||||
"expected":{
|
||||
"debug_log":"Transformation t:trim: \"filedata"
|
||||
"debug_log":"T \\(0\\) t:trim: \"filedata"
|
||||
},
|
||||
"rules":[
|
||||
"SecRuleEngine On",
|
||||
|
||||
@@ -90,8 +90,14 @@ void perform_unit_test(ModSecurityTest<UnitTest> *test, UnitTest *t,
|
||||
}
|
||||
delete op;
|
||||
} else if (t->type == "tfn") {
|
||||
modsecurity::ModSecStackString in;
|
||||
modsecurity::ModSecStackString out;
|
||||
std::string ret;
|
||||
in.assign(t->input.c_str(), t->input.size());
|
||||
Transformation *tfn = Transformation::instantiate("t:" + t->name);
|
||||
std::string ret = tfn->execute(t->input, NULL);
|
||||
tfn->execute(NULL, in, out);
|
||||
ret.assign(out.c_str(), out.size());
|
||||
|
||||
t->obtained = 1;
|
||||
t->obtainedOutput = ret;
|
||||
if (ret != t->output) {
|
||||
|
||||
Reference in New Issue
Block a user