mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 13:26:01 +03:00
SecLang uses RESPONSE_STATUS as variable, not STATUS
Seclang uses RESPONSE_STATUS as variable to encode the status code for the request. https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#RESPONSE_STATUS The CRS v3.0.0-dev rules, for instance, uses the RESPONSE_STATUS variable. https://github.com/SpiderLabs/owasp-modsecurity-crs/blob/v3.0.0-dev/rules/RESPONSE-50-DATA-LEAKAGES-IIS.conf When processing response headers, the variable was named STATUS when creating/storing it in the collection. Fix it, and update regression testcases.
This commit is contained in:
parent
678a97d0f7
commit
28a44b966a
@ -876,7 +876,7 @@ int Transaction::processResponseHeaders(int code, const std::string& proto) {
|
||||
#endif
|
||||
|
||||
this->m_httpCodeReturned = code;
|
||||
this->m_collections.store("STATUS", std::to_string(code));
|
||||
this->m_collections.store("RESPONSE_STATUS", std::to_string(code));
|
||||
m_collections.store("RESPONSE_PROTOCOL", proto);
|
||||
|
||||
if (m_rules->m_secRuleEngine == Rules::DisabledRuleEngine) {
|
||||
|
@ -36,11 +36,11 @@
|
||||
]
|
||||
},
|
||||
"expected":{
|
||||
"debug_log":"Target value: \"200\" \\(Variable: STATUS\\)"
|
||||
"debug_log":"Target value: \"200\" \\(Variable: RESPONSE_STATUS\\)"
|
||||
},
|
||||
"rules":[
|
||||
"SecRuleEngine On",
|
||||
"SecRule STATUS \"@contains test\" \"id:1,phase:5,rev:1.3,pass,t:trim\""
|
||||
"SecRule RESPONSE_STATUS \"@contains test\" \"id:1,phase:5,rev:1.3,pass,t:trim\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -80,13 +80,13 @@
|
||||
]
|
||||
},
|
||||
"expected":{
|
||||
"debug_log":"Target value: \"500\" \\(Variable: STATUS\\)",
|
||||
"debug_log":"Target value: \"500\" \\(Variable: RESPONSE_STATUS\\)",
|
||||
"http_code": 500
|
||||
},
|
||||
"rules":[
|
||||
"SecRuleEngine On",
|
||||
"SecRule ARGS \"@pm value\" \"id:1,phase:2,t:trim,status:500,deny\"",
|
||||
"SecRule STATUS \"@contains test\" \"id:2,phase:5,rev:1.3,pass,t:trim\""
|
||||
"SecRule RESPONSE_STATUS \"@contains test\" \"id:2,phase:5,rev:1.3,pass,t:trim\""
|
||||
]
|
||||
}
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user