mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 21:36:00 +03:00
Check if response body inspection is enabled before process it
This commit is contained in:
parent
389cc25359
commit
42a472adbd
2
CHANGES
2
CHANGES
@ -1,6 +1,8 @@
|
|||||||
v3.0.3 - YYYY-MMM-DD (to be released)
|
v3.0.3 - YYYY-MMM-DD (to be released)
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
- Checks if response body inspection is enabled before process it
|
||||||
|
[Issue #1643 - @zoltan-fedor, @dennus, @defanator, @zimmerle]
|
||||||
- processContentOffset Cleanup
|
- processContentOffset Cleanup
|
||||||
[Issue #1757 - @p0pr0ck5]
|
[Issue #1757 - @p0pr0ck5]
|
||||||
- Fix setvar parsing of quoted data
|
- Fix setvar parsing of quoted data
|
||||||
|
@ -1093,6 +1093,13 @@ int Transaction::processResponseBody() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_rules->m_secResponseBodyAccess != RulesProperties::TrueConfigBoolean) {
|
||||||
|
#ifndef NO_LOGS
|
||||||
|
debug(4, "Response body is disabled, returning... " + std::to_string(m_rules->m_secResponseBodyAccess));
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::set<std::string> &bi = \
|
std::set<std::string> &bi = \
|
||||||
m_rules->m_responseBodyTypeToBeInspected.m_value;
|
m_rules->m_responseBodyTypeToBeInspected.m_value;
|
||||||
auto t = bi.find(m_variableResponseContentType.m_value);
|
auto t = bi.find(m_variableResponseContentType.m_value);
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
},
|
},
|
||||||
"rules": [
|
"rules": [
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecRule ARGS \"@contains test\" \"id:1,t:trim,deny\""
|
"SecRule ARGS \"@contains test\" \"id:1,t:trim,deny\""
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -352,6 +353,7 @@
|
|||||||
},
|
},
|
||||||
"rules": [
|
"rules": [
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecRule ARGS \"@contains test\" \"id:1,phase:4,t:trim,status:500,deny\""
|
"SecRule ARGS \"@contains test\" \"id:1,phase:4,t:trim,status:500,deny\""
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
"SecRule ARGS:key \"@contains other_value\" \"chain,pass,phase:response,id:28\"",
|
"SecRule ARGS:key \"@contains other_value\" \"chain,pass,phase:response,id:28\"",
|
||||||
"SecRule MATCHED_VAR \"@contains Aasdf\" \"\"",
|
"SecRule MATCHED_VAR \"@contains Aasdf\" \"\"",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecRule MATCHED_VAR \"@contains other_value\" \"id:29,phase:response,pass\"",
|
"SecRule MATCHED_VAR \"@contains other_value\" \"id:29,phase:response,pass\"",
|
||||||
"SecRule MATCHED_VAR \"@contains other_value\" \"id:30,phase:response,pass\""
|
"SecRule MATCHED_VAR \"@contains other_value\" \"id:30,phase:response,pass\""
|
||||||
]
|
]
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecResponseBodyMimeType text\/plain text\/html text\/xml",
|
"SecResponseBodyMimeType text\/plain text\/html text\/xml",
|
||||||
"SecRule RESPONSE_BODY \"@contains RESPONSE_CONTENT_TYPE\" \"id:9,pass,t:trim,phase:4\""
|
"SecRule RESPONSE_BODY \"@contains RESPONSE_CONTENT_TYPE\" \"id:9,pass,t:trim,phase:4\""
|
||||||
]
|
]
|
||||||
@ -75,6 +76,7 @@
|
|||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecResponseBodyMimeType application\/something",
|
"SecResponseBodyMimeType application\/something",
|
||||||
"SecRule RESPONSE_BODY \"@contains RESPONSE_CONTENT_TYPE\" \"id:9,pass,t:trim,phase:4\""
|
"SecRule RESPONSE_BODY \"@contains RESPONSE_CONTENT_TYPE\" \"id:9,pass,t:trim,phase:4\""
|
||||||
]
|
]
|
||||||
@ -115,6 +117,7 @@
|
|||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecResponseBodyMimeType text\/plain text\/tml text\/xml",
|
"SecResponseBodyMimeType text\/plain text\/tml text\/xml",
|
||||||
"SecResponseBodyMimeTypesClear",
|
"SecResponseBodyMimeTypesClear",
|
||||||
"SecRule RESPONSE_BODY \"@contains RESPONSE_CONTENT_TYPE\" \"id:9,pass,t:trim,phase:4\""
|
"SecRule RESPONSE_BODY \"@contains RESPONSE_CONTENT_TYPE\" \"id:9,pass,t:trim,phase:4\""
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecRule OUTBOUND_DATA_ERROR \"@eq 1\" \"id:1,phase:4,pass,t:trim\""
|
"SecRule OUTBOUND_DATA_ERROR \"@eq 1\" \"id:1,phase:4,pass,t:trim\""
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -108,6 +109,7 @@
|
|||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecResponseBodyLimit 2",
|
"SecResponseBodyLimit 2",
|
||||||
"SecRule OUTBOUND_DATA_ERROR \"@eq 1\" \"id:1,phase:4,pass,t:trim\""
|
"SecRule OUTBOUND_DATA_ERROR \"@eq 1\" \"id:1,phase:4,pass,t:trim\""
|
||||||
]
|
]
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecRule RESPONSE_BODY \"@contains denystring\" \"id:1,phase:4,deny\""
|
"SecRule RESPONSE_BODY \"@contains denystring\" \"id:1,phase:4,deny\""
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecRule RESPONSE_CONTENT_LENGTH \"@contains test \" \"id:1,phase:4,pass,t:trim\""
|
"SecRule RESPONSE_CONTENT_LENGTH \"@contains test \" \"id:1,phase:4,pass,t:trim\""
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
},
|
},
|
||||||
"rules":[
|
"rules":[
|
||||||
"SecRuleEngine On",
|
"SecRuleEngine On",
|
||||||
|
"SecResponseBodyAccess On",
|
||||||
"SecRequestBodyAccess On",
|
"SecRequestBodyAccess On",
|
||||||
"SecRule RESPONSE_BODY \"@rx ([0-9]+)\" \"id:1,phase:4,capture,id:105\"",
|
"SecRule RESPONSE_BODY \"@rx ([0-9]+)\" \"id:1,phase:4,capture,id:105\"",
|
||||||
"SecRule TX \"@rx ([A-z]+)\" \"phase:4,id:106\""
|
"SecRule TX \"@rx ([A-z]+)\" \"phase:4,id:106\""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user