mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Adds support to m_highlightJSON in RuleMessage class
This variable helds a JSON with information regarding all matches. Only filled when IncludeFullHighlightLog property is set.
This commit is contained in:
parent
eec95cfe17
commit
e83f66ee49
@ -237,6 +237,10 @@ end:
|
||||
modsecurity::RuleMessage::computeHighlight(ruleMessage,
|
||||
ruleMessage->m_buf);
|
||||
highlightToText(h);
|
||||
std::cout << "Highlight JSON:" << std::endl;
|
||||
std::cout << ruleMessage->m_highlightJSON << std::endl;
|
||||
std::cout << "Request:" << std::endl;
|
||||
std::cout << ruleMessage->m_buf;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ extern "C" {
|
||||
* Notice that the highlight can be calculate post-analisys. Calculate it
|
||||
* during the analisys may delay the analisys process.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
IncludeFullHighlightLogProperty = 4,
|
||||
};
|
||||
|
||||
|
@ -151,6 +151,7 @@ class RuleMessage {
|
||||
|
||||
std::list<std::string> m_tags;
|
||||
RuleMessageHighlight m_highlight;
|
||||
std::string m_highlightJSON;
|
||||
};
|
||||
|
||||
|
||||
|
@ -215,7 +215,7 @@ SecDataDir /tmp/
|
||||
# trigger a server error (determined by a 5xx or 4xx, excluding 404,
|
||||
# level response status codes).
|
||||
#
|
||||
SecAuditEngine RelevantOnly
|
||||
SecAuditEngine Off
|
||||
SecAuditLogRelevantStatus "^(?:5|4(?!04))"
|
||||
|
||||
# Log everything we know about a transaction.
|
||||
|
@ -207,6 +207,8 @@ void ModSecurity::serverLog(void *data, std::shared_ptr<RuleMessage> rm) {
|
||||
if (m_logProperties & RuleMessageLogProperty) {
|
||||
const void *a = static_cast<const void *>(rm.get());
|
||||
if (m_logProperties & IncludeFullHighlightLogProperty) {
|
||||
processContentOffset(rm->m_buf.c_str(), rm->m_buf.size(),
|
||||
rm->m_reference.c_str(), &rm->m_highlightJSON, NULL);
|
||||
m_logCb(data, a);
|
||||
return;
|
||||
}
|
||||
|
@ -93,7 +93,10 @@ std::string RuleMessage::log(const RuleMessage *rm, int props, int code) {
|
||||
return modsecurity::utils::string::toHexIfNeeded(msg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Depricated. Do not use. Should be removed before merge.
|
||||
*
|
||||
*/
|
||||
RuleMessageHighlight RuleMessage::computeHighlight(const RuleMessage *rm,
|
||||
const std::string buf) {
|
||||
RuleMessageHighlight ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user