mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Checks if an assay is relevant to be saved as an auditlog
This commit is contained in:
parent
0beae17b4f
commit
fc622c27df
@ -592,6 +592,9 @@ int Assay::processLogging() {
|
|||||||
debug(4, "Starting phase LOGGING. (SecRules 5)");
|
debug(4, "Starting phase LOGGING. (SecRules 5)");
|
||||||
this->m_rules->evaluate(ModSecurity::LoggingPhase, this);
|
this->m_rules->evaluate(ModSecurity::LoggingPhase, this);
|
||||||
|
|
||||||
|
/* If relevant, save this assay information at the audit_logs */
|
||||||
|
this->m_rules->audit_log->saveIfRelevant(this);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +136,24 @@ bool AuditLog::isRelevant(int status) {
|
|||||||
|
|
||||||
|
|
||||||
bool AuditLog::saveIfRelevant(Assay *assay) {
|
bool AuditLog::saveIfRelevant(Assay *assay) {
|
||||||
|
if (this->isRelevant(assay->http_code_returned) == false &&
|
||||||
|
assay->save_in_auditlog == false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Even if it is relevant, if it is marked not to be save,
|
||||||
|
* we won't save it.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if (assay->do_not_save_in_auditlog == true) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string log = logfy(assay);
|
||||||
|
|
||||||
|
m_writer->write(log);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user