mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +03:00
Adds support to the REQUEST_LINE variable
This commit is contained in:
parent
cb722c74b9
commit
bc925e01e6
@ -219,6 +219,9 @@ int Assay::processURI(const char *uri, const char *protocol,
|
|||||||
|
|
||||||
const char *pos = strchr(m_uri_decoded.c_str(), '?');
|
const char *pos = strchr(m_uri_decoded.c_str(), '?');
|
||||||
|
|
||||||
|
store_variable("REQUEST_LINE", std::string(protocol) + " " +
|
||||||
|
std::string(uri) + " HTTP/" + std::string(http_version));
|
||||||
|
|
||||||
std::string path_info;
|
std::string path_info;
|
||||||
if (pos == NULL) {
|
if (pos == NULL) {
|
||||||
path_info = std::string(m_uri_decoded, 0);
|
path_info = std::string(m_uri_decoded, 0);
|
||||||
|
45
test/test-cases/regression/variable-REQUEST_LINE.json
Normal file
45
test/test-cases/regression/variable-REQUEST_LINE.json
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"enabled":1,
|
||||||
|
"version_min":300000,
|
||||||
|
"title":"Testing Variables :: REQUEST_LINE",
|
||||||
|
"client":{
|
||||||
|
"ip":"200.249.12.31",
|
||||||
|
"port":123
|
||||||
|
},
|
||||||
|
"server":{
|
||||||
|
"ip":"200.249.12.31",
|
||||||
|
"port":80
|
||||||
|
},
|
||||||
|
"request":{
|
||||||
|
"headers":{
|
||||||
|
"Host":"localhost",
|
||||||
|
"User-Agent":"curl/7.38.0",
|
||||||
|
"Accept":"*/*"
|
||||||
|
},
|
||||||
|
"uri":"/?key=value&key=other_value",
|
||||||
|
"protocol":"GET",
|
||||||
|
"http_version":1.1
|
||||||
|
},
|
||||||
|
"response":{
|
||||||
|
"headers":{
|
||||||
|
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
|
||||||
|
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
|
||||||
|
"Content-Type":"text/html"
|
||||||
|
},
|
||||||
|
"body":[
|
||||||
|
"no need."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"expected":{
|
||||||
|
"debug_log":"Target value: \"GET /\\?key=value\\&key=other_value HTTP/1.1\" \\(Variable: REQUEST_LINE\\)"
|
||||||
|
},
|
||||||
|
"rules":[
|
||||||
|
"SecRuleEngine On",
|
||||||
|
"SecDebugLog \/tmp\/modsec_debug.log",
|
||||||
|
"SecDebugLogLevel 9",
|
||||||
|
"SecRule REQUEST_LINE \"@contains test \" \"pass,t:trim\""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user