mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Having disruptive msgs as disruptive [instead of warnings] on audit log
Issue #1592
This commit is contained in:
@@ -53,6 +53,33 @@ std::string RuleMessage::disruptiveErrorLog(const RuleMessage *rm) {
|
||||
return modsecurity::utils::string::toHexIfNeeded(msg);
|
||||
}
|
||||
|
||||
std::string RuleMessage::noClientErrorLog(const RuleMessage *rm, bool disruptive) {
|
||||
std::string msg;
|
||||
if (disruptive == false) {
|
||||
return RuleMessage::noClientErrorLog(rm);
|
||||
}
|
||||
|
||||
msg.append("Message: ");
|
||||
msg.append(rm->m_disruptiveMessage);
|
||||
msg.append(rm->m_match);
|
||||
msg.append(" [file \"" + std::string(rm->m_ruleFile) + "\"]");
|
||||
msg.append(" [line \"" + std::to_string(rm->m_ruleLine) + "\"]");
|
||||
msg.append(" [id \"" + std::to_string(rm->m_ruleId) + "\"]");
|
||||
msg.append(" [rev \"" + rm->m_rev + "\"]");
|
||||
msg.append(" [msg \"" + rm->m_message + "\"]");
|
||||
msg.append(" [data \"" + rm->m_data + "\"]");
|
||||
msg.append(" [severity \"" +
|
||||
std::to_string(rm->m_severity) + "\"]");
|
||||
msg.append(" [ver \"" + rm->m_ver + "\"]");
|
||||
msg.append(" [maturity \"" + std::to_string(rm->m_maturity) + "\"]");
|
||||
msg.append(" [accuracy \"" + std::to_string(rm->m_accuracy) + "\"]");
|
||||
for (auto &a : rm->m_tags) {
|
||||
msg.append(" [tag \"" + a + "\"]");
|
||||
}
|
||||
msg.append(" [ref \"" + rm->m_reference + "\"]");
|
||||
|
||||
return modsecurity::utils::string::toHexIfNeeded(msg);
|
||||
}
|
||||
|
||||
std::string RuleMessage::noClientErrorLog(const RuleMessage *rm) {
|
||||
std::string msg;
|
||||
|
@@ -1485,7 +1485,11 @@ std::string Transaction::toOldAuditLogFormat(int parts,
|
||||
if (parts & audit_log::AuditLog::HAuditLogPart) {
|
||||
audit_log << "--" << trailer << "-" << "H--" << std::endl;
|
||||
for (auto a : m_rulesMessages) {
|
||||
audit_log << a.noClientErrorLog() << std::endl;
|
||||
if (a.m_isDisruptive == true) {
|
||||
audit_log << a.noClientErrorLog(true) << std::endl;
|
||||
} else {
|
||||
audit_log << a.noClientErrorLog() << std::endl;
|
||||
}
|
||||
}
|
||||
audit_log << std::endl;
|
||||
/** TODO: write audit_log H part. */
|
||||
|
Reference in New Issue
Block a user