Adds suppor to the REQUEST_FILENAME variable

This commit is contained in:
Felipe Zimmerle 2015-07-22 01:33:46 -03:00
parent 94eddfcf48
commit 97c0d561f6
2 changed files with 46 additions and 0 deletions

View File

@ -220,6 +220,7 @@ int Assay::processURI(const char *uri, const char *protocol,
store_variable("QUERY_STRING", std::string(strchr(m_uri, '?')));
}
store_variable("PATH_INFO", path_info);
store_variable("REQUEST_FILENAME", path_info);
size_t offset = path_info.find_last_of("/\\");
if (offset != std::string::npos) {

View File

@ -0,0 +1,45 @@
[
{
"enabled":1,
"version_min":300000,
"title":"Testing Variables :: REQUEST_FILENAME",
"client":{
"ip":"200.249.12.31",
"port":123
},
"server":{
"ip":"200.249.12.11",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*",
"Content-Length":"27",
"Content-Type":"application/x-www-form-urlencoded"
},
"uri":"/one/two/login.php?key1=value1&key2=v%20a%20l%20u%20e%202",
"protocol":"GET"
},
"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: \"/one/two/login.php\" \\(Variable: REQUEST_FILENAME\\)"
},
"rules":[
"SecRuleEngine On",
"SecDebugLog \/tmp\/modsec_debug.log",
"SecDebugLogLevel 9",
"SecRule REQUEST_FILENAME \"@contains test \" \"phase:3,pass,t:trim\""
]
}
]