mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 01:22:18 +03:00
Computes auditlog during rules load time
This commit is contained in:
@@ -33,20 +33,20 @@ namespace actions {
|
||||
class Action {
|
||||
public:
|
||||
Action()
|
||||
: m_name(""),
|
||||
m_parserPayload("")
|
||||
: m_parserPayload(""),
|
||||
m_name("")
|
||||
{ }
|
||||
|
||||
|
||||
explicit Action(const std::string& action)
|
||||
: m_name(sort_name(action)),
|
||||
m_parserPayload(sort_payload(action))
|
||||
: m_parserPayload(sort_payload(action)),
|
||||
m_name(sort_name(action))
|
||||
{ }
|
||||
|
||||
|
||||
Action(const Action &a)
|
||||
: m_name(a.m_name),
|
||||
m_parserPayload(a.m_parserPayload)
|
||||
: m_parserPayload(a.m_parserPayload),
|
||||
m_name(a.m_name)
|
||||
{ }
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class Action {
|
||||
}
|
||||
|
||||
|
||||
const std::string *getName() {
|
||||
const std::string *getName() const {
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
|
||||
@@ -170,9 +170,8 @@ class AuditLog {
|
||||
bool init(std::string *error);
|
||||
virtual bool close();
|
||||
|
||||
bool saveIfRelevant(Transaction *transaction);
|
||||
bool saveIfRelevant(Transaction *transaction, int parts);
|
||||
bool isRelevant(int status);
|
||||
bool saveIfRelevant(Transaction *transaction) const noexcept;
|
||||
bool isRelevant(int status) const noexcept;
|
||||
|
||||
static int addParts(int parts, const std::string& new_parts);
|
||||
static int removeParts(int parts, const std::string& new_parts);
|
||||
|
||||
@@ -130,6 +130,8 @@ class RuleMessage {
|
||||
std::string getUri() const;
|
||||
bool isDisruptive() const;
|
||||
|
||||
bool toBeAuditLog() const;
|
||||
|
||||
int m_severity;
|
||||
std::list<std::string> m_tags;
|
||||
|
||||
|
||||
@@ -322,8 +322,7 @@ class TransactionSecMarkerManagement {
|
||||
class TransactionRuleMessageManagement {
|
||||
public:
|
||||
explicit TransactionRuleMessageManagement(Transaction *t)
|
||||
: m_transaction(t),
|
||||
m_noAuditLog(false) {
|
||||
: m_transaction(t) {
|
||||
messageNew();
|
||||
};
|
||||
|
||||
@@ -332,22 +331,7 @@ class TransactionRuleMessageManagement {
|
||||
|
||||
void logMatchLastRuleOnTheChain(RuleWithActions *rule);
|
||||
|
||||
void messageSetNoAuditLog(bool a) {
|
||||
m_noAuditLog = a;
|
||||
}
|
||||
|
||||
bool messageSaveAuditLog() const {
|
||||
return m_noAuditLog;
|
||||
}
|
||||
|
||||
std::list<RuleMessage *> messageGetAll() {
|
||||
std::list<RuleMessage *> messages;
|
||||
for (RuleMessage *a : m_rulesMessages) {
|
||||
messages.push_back(a);
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
std::list<RuleMessage *> messageGetAll();
|
||||
|
||||
void messageClear() {
|
||||
m_rulesMessages.clear();
|
||||
@@ -362,7 +346,6 @@ class TransactionRuleMessageManagement {
|
||||
std::list<RuleMessage *> m_rulesMessages;
|
||||
|
||||
Transaction *m_transaction;
|
||||
bool m_noAuditLog;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user