mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +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
1b27c6ccae
commit
e84fb9d00f
@ -237,6 +237,10 @@ end:
|
|||||||
modsecurity::RuleMessage::computeHighlight(ruleMessage,
|
modsecurity::RuleMessage::computeHighlight(ruleMessage,
|
||||||
ruleMessage->m_buf);
|
ruleMessage->m_buf);
|
||||||
highlightToText(h);
|
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;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ extern "C" {
|
|||||||
* Notice that the highlight can be calculate post-analisys. Calculate it
|
* Notice that the highlight can be calculate post-analisys. Calculate it
|
||||||
* during the analisys may delay the analisys process.
|
* during the analisys may delay the analisys process.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
IncludeFullHighlightLogProperty = 4,
|
IncludeFullHighlightLogProperty = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -151,6 +151,7 @@ class RuleMessage {
|
|||||||
|
|
||||||
std::list<std::string> m_tags;
|
std::list<std::string> m_tags;
|
||||||
RuleMessageHighlight m_highlight;
|
RuleMessageHighlight m_highlight;
|
||||||
|
std::string m_highlightJSON;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ SecDataDir /tmp/
|
|||||||
# trigger a server error (determined by a 5xx or 4xx, excluding 404,
|
# trigger a server error (determined by a 5xx or 4xx, excluding 404,
|
||||||
# level response status codes).
|
# level response status codes).
|
||||||
#
|
#
|
||||||
SecAuditEngine RelevantOnly
|
SecAuditEngine Off
|
||||||
SecAuditLogRelevantStatus "^(?:5|4(?!04))"
|
SecAuditLogRelevantStatus "^(?:5|4(?!04))"
|
||||||
|
|
||||||
# Log everything we know about a transaction.
|
# Log everything we know about a transaction.
|
||||||
|
@ -206,6 +206,8 @@ void ModSecurity::serverLog(void *data, std::shared_ptr<RuleMessage> rm) {
|
|||||||
if (m_logProperties & RuleMessageLogProperty) {
|
if (m_logProperties & RuleMessageLogProperty) {
|
||||||
const void *a = static_cast<const void *>(rm.get());
|
const void *a = static_cast<const void *>(rm.get());
|
||||||
if (m_logProperties & IncludeFullHighlightLogProperty) {
|
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);
|
m_logCb(data, a);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,10 @@ std::string RuleMessage::log(const RuleMessage *rm, int props, int code) {
|
|||||||
return modsecurity::utils::string::toHexIfNeeded(msg);
|
return modsecurity::utils::string::toHexIfNeeded(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Depricated. Do not use. Should be removed before merge.
|
||||||
|
*
|
||||||
|
*/
|
||||||
RuleMessageHighlight RuleMessage::computeHighlight(const RuleMessage *rm,
|
RuleMessageHighlight RuleMessage::computeHighlight(const RuleMessage *rm,
|
||||||
const std::string buf) {
|
const std::string buf) {
|
||||||
RuleMessageHighlight ret;
|
RuleMessageHighlight ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user