mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Refactoring: rename evaluate to execute on actions
This commit is contained in:
parent
6cdbad05ad
commit
1f7d202985
@ -47,7 +47,7 @@ class Action {
|
||||
m_parser_payload("") {
|
||||
set_name_and_payload(_action);
|
||||
}
|
||||
explicit Action(const std::string& _action, int kind)
|
||||
Action(const std::string& _action, int kind)
|
||||
: m_isNone(false),
|
||||
temporaryAction(false),
|
||||
action_kind(kind),
|
||||
@ -65,12 +65,12 @@ class Action {
|
||||
|
||||
virtual ~Action() { }
|
||||
|
||||
virtual std::string evaluate(const std::string &exp,
|
||||
virtual std::string execute(const std::string &exp,
|
||||
Transaction *transaction);
|
||||
virtual bool evaluate(RuleWithActions *rule, Transaction *transaction);
|
||||
virtual bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
virtual bool execute(RuleWithActions *rule, Transaction *transaction);
|
||||
virtual bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &ruleMessage) {
|
||||
return evaluate(rule, transaction);
|
||||
return execute(rule, transaction);
|
||||
}
|
||||
virtual bool init(std::string *error) { return true; }
|
||||
virtual bool isDisruptive() { return false; }
|
||||
|
@ -39,7 +39,8 @@ bool Accuracy::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Accuracy::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Accuracy::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
rule->setAccuracy(m_accuracy);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class Accuracy : public Action {
|
||||
: Action(action, ConfigurationKind),
|
||||
m_accuracy(0) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
int getAccuracy() const { return m_accuracy; }
|
||||
|
||||
|
@ -45,13 +45,13 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
std::string Action::evaluate(const std::string &value,
|
||||
std::string Action::execute(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
bool Action::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Action::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool AuditLog::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool AuditLog::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
transaction->messageSetNoAuditLog(false);
|
||||
return true;
|
||||
|
@ -35,7 +35,7 @@ class AuditLog : public Action {
|
||||
explicit AuditLog(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool Block::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Block::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
ms_dbg_a(transaction, 8, "Marking request as disruptive.");
|
||||
return true;
|
||||
|
@ -35,7 +35,7 @@ class Block : public Action {
|
||||
public:
|
||||
explicit Block(const std::string &action) : Action(action) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool Capture::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Capture::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class Capture : public Action {
|
||||
explicit Capture(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool Chain::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Chain::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
rule->setHasChainAction(true);
|
||||
return true;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class Chain : public Action {
|
||||
explicit Chain(const std::string &action)
|
||||
: Action(action, ConfigurationKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
};
|
||||
|
||||
} // namespace actions
|
||||
|
@ -38,7 +38,7 @@ bool AuditLogParts::init(std::string *error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AuditLogParts::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool AuditLogParts::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
transaction->m_auditLogModifier.push_back(
|
||||
std::make_pair(mPartsAction, mParts));
|
||||
return true;
|
||||
|
@ -33,7 +33,7 @@ class AuditLogParts : public Action {
|
||||
mPartsAction(0),
|
||||
mParts("") { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
|
||||
protected:
|
||||
|
@ -42,7 +42,7 @@ bool RequestBodyAccess::init(std::string *error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RequestBodyAccess::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool RequestBodyAccess::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
if (m_request_body_access) {
|
||||
transaction->m_requestBodyAccess = RulesSetProperties::TrueConfigBoolean;
|
||||
} else {
|
||||
|
@ -34,7 +34,7 @@ class RequestBodyAccess : public Action {
|
||||
m_request_body_access(false) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
bool m_request_body_access;
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ namespace actions {
|
||||
namespace ctl {
|
||||
|
||||
|
||||
bool RequestBodyProcessorJSON::evaluate(RuleWithActions *rule,
|
||||
bool RequestBodyProcessorJSON::execute(RuleWithActions *rule,
|
||||
Transaction *transaction) {
|
||||
transaction->m_requestBodyProcessor = Transaction::JSONRequestBody;
|
||||
transaction->m_variableReqbodyProcessor.set("JSON",
|
||||
|
@ -31,7 +31,7 @@ class RequestBodyProcessorJSON : public Action {
|
||||
explicit RequestBodyProcessorJSON(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace actions {
|
||||
namespace ctl {
|
||||
|
||||
|
||||
bool RequestBodyProcessorURLENCODED::evaluate(RuleWithActions *rule,
|
||||
bool RequestBodyProcessorURLENCODED::execute(RuleWithActions *rule,
|
||||
Transaction *transaction) {
|
||||
transaction->m_requestBodyType = Transaction::WWWFormUrlEncoded;
|
||||
transaction->m_variableReqbodyProcessor.set("URLENCODED",
|
||||
|
@ -31,7 +31,7 @@ class RequestBodyProcessorURLENCODED : public Action {
|
||||
explicit RequestBodyProcessorURLENCODED(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace actions {
|
||||
namespace ctl {
|
||||
|
||||
|
||||
bool RequestBodyProcessorXML::evaluate(RuleWithActions *rule,
|
||||
bool RequestBodyProcessorXML::execute(RuleWithActions *rule,
|
||||
Transaction *transaction) {
|
||||
transaction->m_requestBodyProcessor = Transaction::XMLRequestBody;
|
||||
transaction->m_variableReqbodyProcessor.set("XML",
|
||||
|
@ -31,7 +31,7 @@ class RequestBodyProcessorXML : public Action {
|
||||
explicit RequestBodyProcessorXML(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ bool RuleEngine::init(std::string *error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RuleEngine::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool RuleEngine::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
std::stringstream a;
|
||||
a << "Setting SecRuleEngine to ";
|
||||
a << modsecurity::RulesSetProperties::ruleEngineStateString(m_ruleEngine);
|
||||
|
@ -35,7 +35,7 @@ class RuleEngine : public Action {
|
||||
m_ruleEngine(RulesSetProperties::PropertyNotSetRuleEngine) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
RulesSetProperties::RuleEngine m_ruleEngine;
|
||||
};
|
||||
|
@ -83,7 +83,7 @@ bool RuleRemoveById::init(std::string *error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RuleRemoveById::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool RuleRemoveById::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
for (auto &i : m_ids) {
|
||||
transaction->m_ruleRemoveById.push_back(i);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class RuleRemoveById : public Action {
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
std::list<std::pair<int, int> > m_ranges;
|
||||
std::list<int> m_ids;
|
||||
|
@ -32,7 +32,7 @@ bool RuleRemoveByTag::init(std::string *error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RuleRemoveByTag::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool RuleRemoveByTag::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
transaction->m_ruleRemoveByTag.push_back(m_tag);
|
||||
return true;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class RuleRemoveByTag : public Action {
|
||||
m_tag("") { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
std::string m_tag;
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ bool RuleRemoveTargetById::init(std::string *error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RuleRemoveTargetById::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool RuleRemoveTargetById::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
transaction->m_ruleRemoveTargetById.push_back(
|
||||
std::make_pair(m_id, m_target));
|
||||
return true;
|
||||
|
@ -35,7 +35,7 @@ class RuleRemoveTargetById : public Action {
|
||||
m_target("") { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
int m_id;
|
||||
std::string m_target;
|
||||
|
@ -44,7 +44,7 @@ bool RuleRemoveTargetByTag::init(std::string *error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RuleRemoveTargetByTag::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool RuleRemoveTargetByTag::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
transaction->m_ruleRemoveTargetByTag.push_back(
|
||||
std::make_pair(m_tag, m_target));
|
||||
return true;
|
||||
|
@ -33,7 +33,7 @@ class RuleRemoveTargetByTag : public Action {
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
std::string m_tag;
|
||||
std::string m_target;
|
||||
|
@ -38,7 +38,7 @@ bool Status::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Status::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Status::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
transaction->m_it.status = m_status;
|
||||
return true;
|
||||
|
@ -37,7 +37,7 @@ class Status : public Action {
|
||||
m_status(0) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
|
||||
int m_status;
|
||||
|
@ -49,7 +49,7 @@ bool Allow::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Allow::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Allow::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
ms_dbg_a(transaction, 4, "Dropping the evaluation of upcoming rules " \
|
||||
"in favor of an `allow' action of type: " \
|
||||
+ allowTypeToName(m_allowType));
|
||||
|
@ -59,7 +59,7 @@ class Allow : public Action {
|
||||
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool isDisruptive() override { return true; }
|
||||
|
||||
AllowType m_allowType;
|
||||
|
@ -28,7 +28,7 @@ namespace actions {
|
||||
namespace disruptive {
|
||||
|
||||
|
||||
bool Deny::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Deny::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
ms_dbg_a(transaction, 8, "Running action deny");
|
||||
|
||||
|
@ -33,7 +33,7 @@ class Deny : public Action {
|
||||
public:
|
||||
explicit Deny(const std::string &action) : Action(action) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
bool isDisruptive() override { return true; }
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ namespace actions {
|
||||
namespace disruptive {
|
||||
|
||||
|
||||
bool Drop::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Drop::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
ms_dbg_a(transaction, 8, "Running action drop " \
|
||||
"[executing deny instead of drop.]");
|
||||
|
@ -32,7 +32,7 @@ class Drop : public Action {
|
||||
public:
|
||||
explicit Drop(const std::string &action) : Action(action) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
bool isDisruptive() override { return true; }
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ namespace actions {
|
||||
namespace disruptive {
|
||||
|
||||
|
||||
bool Pass::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Pass::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
intervention::free(&transaction->m_it);
|
||||
intervention::reset(&transaction->m_it);
|
||||
|
@ -31,7 +31,7 @@ class Pass : public Action {
|
||||
public:
|
||||
explicit Pass(const std::string &action) : Action(action) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
bool isDisruptive() override { return true; }
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ bool Redirect::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Redirect::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Redirect::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
std::string m_urlExpanded(m_string->evaluate(transaction));
|
||||
/* if it was changed before, lets keep it. */
|
||||
|
@ -46,7 +46,7 @@ class Redirect : public Action {
|
||||
m_status(0),
|
||||
m_string(std::move(z)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
bool init(std::string *error) override;
|
||||
bool isDisruptive() override { return true; }
|
||||
|
@ -49,7 +49,7 @@ bool Exec::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Exec::evaluate(RuleWithActions *rule, Transaction *t) {
|
||||
bool Exec::execute(RuleWithActions *rule, Transaction *t) {
|
||||
ms_dbg_a(t, 8, "Running script... " + m_script);
|
||||
m_lua.run(t);
|
||||
return true;
|
||||
|
@ -36,7 +36,7 @@ class Exec : public Action {
|
||||
|
||||
~Exec() { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
|
||||
private:
|
||||
|
@ -54,7 +54,7 @@ bool InitCol::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool InitCol::evaluate(RuleWithActions *rule, Transaction *t) {
|
||||
bool InitCol::execute(RuleWithActions *rule, Transaction *t) {
|
||||
std::string collectionName(m_string->evaluate(t));
|
||||
|
||||
if (m_collection_key == "ip") {
|
||||
|
@ -38,7 +38,7 @@ class InitCol : public Action {
|
||||
: Action(action, RunTimeOnlyIfMatchKind),
|
||||
m_string(std::move(z)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
private:
|
||||
std::string m_collection_key;
|
||||
|
@ -28,7 +28,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool Log::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Log::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
return true;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class Log : public Action {
|
||||
explicit Log(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool LogData::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool LogData::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
rm.m_data = data(transaction);
|
||||
|
||||
|
@ -39,7 +39,7 @@ class LogData : public Action {
|
||||
: Action("logdata", RunTimeOnlyIfMatchKind),
|
||||
m_string(std::move(z)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
|
||||
std::string data(Transaction *Transaction);
|
||||
|
@ -39,7 +39,7 @@ bool Maturity::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Maturity::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Maturity::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class Maturity : public Action {
|
||||
: Action(action, ConfigurationKind),
|
||||
m_maturity(0) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
int getMaturity() const { return m_maturity; }
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool Msg::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Msg::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
std::string msg = data(transaction);
|
||||
rm.m_message = msg;
|
||||
|
@ -40,7 +40,7 @@ class Msg : public Action {
|
||||
: Action("msg", RunTimeOnlyIfMatchKind),
|
||||
m_string(std::move(z)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
|
||||
std::string data(Transaction *Transaction);
|
||||
|
@ -25,7 +25,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool MultiMatch::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool MultiMatch::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ class MultiMatch : public Action {
|
||||
explicit MultiMatch(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
};
|
||||
|
||||
} // namespace actions
|
||||
|
@ -26,7 +26,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool NoAuditLog::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool NoAuditLog::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
transaction->messageSetNoAuditLog(true);
|
||||
return true;
|
||||
|
@ -35,7 +35,7 @@ class NoAuditLog : public Action {
|
||||
explicit NoAuditLog(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool NoLog::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool NoLog::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
return true;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class NoLog : public Action {
|
||||
explicit NoLog(const std::string &action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
};
|
||||
|
||||
|
@ -72,7 +72,7 @@ bool Phase::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Phase::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Phase::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
rule->setPhase(m_phase);
|
||||
return true;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class Phase : public Action {
|
||||
m_secRulesPhase(0) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
int m_phase;
|
||||
int m_secRulesPhase;
|
||||
|
@ -33,7 +33,7 @@ bool Rev::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Rev::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Rev::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class Rev : public Action {
|
||||
public:
|
||||
explicit Rev(const std::string &action) : Action(action, ConfigurationKind) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
std::string getRevision() const { return m_rev; }
|
||||
|
||||
|
@ -48,7 +48,7 @@ bool RuleId::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool RuleId::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool RuleId::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
rule->setId(m_ruleId);
|
||||
return true;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class RuleId : public Action {
|
||||
m_ruleId(0) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
private:
|
||||
double m_ruleId;
|
||||
|
@ -31,7 +31,7 @@ bool SetENV::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool SetENV::evaluate(RuleWithActions *rule, Transaction *t) {
|
||||
bool SetENV::execute(RuleWithActions *rule, Transaction *t) {
|
||||
std::string colNameExpanded(m_string->evaluate(t));
|
||||
|
||||
ms_dbg_a(t, 8, "Setting envoriment variable: "
|
||||
|
@ -39,7 +39,7 @@ class SetENV : public Action {
|
||||
: Action("setenv", RunTimeOnlyIfMatchKind),
|
||||
m_string(std::move(z)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
|
||||
private:
|
||||
|
@ -31,7 +31,7 @@ bool SetRSC::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool SetRSC::evaluate(RuleWithActions *rule, Transaction *t) {
|
||||
bool SetRSC::execute(RuleWithActions *rule, Transaction *t) {
|
||||
std::string colNameExpanded(m_string->evaluate(t));
|
||||
ms_dbg_a(t, 8, "RESOURCE initiated with value: \'"
|
||||
+ colNameExpanded + "\'.");
|
||||
|
@ -39,7 +39,7 @@ class SetRSC : public Action {
|
||||
: Action("setsrc", RunTimeOnlyIfMatchKind),
|
||||
m_string(std::move(z)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
|
||||
private:
|
||||
|
@ -31,7 +31,7 @@ bool SetSID::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool SetSID::evaluate(RuleWithActions *rule, Transaction *t) {
|
||||
bool SetSID::execute(RuleWithActions *rule, Transaction *t) {
|
||||
std::string colNameExpanded(m_string->evaluate(t));
|
||||
ms_dbg_a(t, 8, "Session ID initiated with value: \'"
|
||||
+ colNameExpanded + "\'.");
|
||||
|
@ -39,7 +39,7 @@ class SetSID : public Action {
|
||||
: Action("setsid", RunTimeOnlyIfMatchKind),
|
||||
m_string(std::move(z)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
|
||||
private:
|
||||
|
@ -31,7 +31,7 @@ bool SetUID::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool SetUID::evaluate(RuleWithActions *rule, Transaction *t) {
|
||||
bool SetUID::execute(RuleWithActions *rule, Transaction *t) {
|
||||
std::string colNameExpanded(m_string->evaluate(t));
|
||||
ms_dbg_a(t, 8, "User collection initiated with value: \'"
|
||||
+ colNameExpanded + "\'.");
|
||||
|
@ -39,7 +39,7 @@ class SetUID : public Action {
|
||||
: Action("setuid", RunTimeOnlyIfMatchKind),
|
||||
m_string(std::move(z)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
|
||||
private:
|
||||
|
@ -40,7 +40,7 @@ bool SetVar::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool SetVar::evaluate(RuleWithActions *rule, Transaction *t) {
|
||||
bool SetVar::execute(RuleWithActions *rule, Transaction *t) {
|
||||
std::string targetValue;
|
||||
std::string resolvedPre;
|
||||
|
||||
|
@ -58,7 +58,7 @@ class SetVar : public Action {
|
||||
m_operation(operation),
|
||||
m_variable(std::move(variable)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool init(std::string *error) override;
|
||||
|
||||
private:
|
||||
|
@ -71,7 +71,7 @@ bool Severity::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Severity::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Severity::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
return true;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class Severity : public Action {
|
||||
: Action(action),
|
||||
m_severity(0) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
bool init(std::string *error) override;
|
||||
|
||||
|
@ -38,7 +38,7 @@ bool Skip::init(std::string *error) {
|
||||
}
|
||||
|
||||
|
||||
bool Skip::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool Skip::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
ms_dbg_a(transaction, 5, "Skipping the next " + \
|
||||
std::to_string(m_skip_next) + " rules.");
|
||||
|
||||
|
@ -34,7 +34,7 @@ class Skip : public Action {
|
||||
m_skip_next(0) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
|
||||
int m_skip_next;
|
||||
};
|
||||
|
@ -27,7 +27,7 @@ namespace modsecurity {
|
||||
namespace actions {
|
||||
|
||||
|
||||
bool SkipAfter::evaluate(RuleWithActions *rule, Transaction *transaction) {
|
||||
bool SkipAfter::execute(RuleWithActions *rule, Transaction *transaction) {
|
||||
ms_dbg_a(transaction, 5, "Setting skipAfter for: " + *m_skipName);
|
||||
transaction->addMarker(m_skipName);
|
||||
return true;
|
||||
|
@ -34,7 +34,7 @@ class SkipAfter : public Action {
|
||||
: Action(action, RunTimeOnlyIfMatchKind),
|
||||
m_skipName(std::make_shared<std::string>(m_parser_payload)) { }
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction) override;
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction) override;
|
||||
private:
|
||||
std::shared_ptr<std::string> m_skipName;
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ std::string Tag::getName(Transaction *transaction) {
|
||||
}
|
||||
|
||||
|
||||
bool Tag::evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool Tag::execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) {
|
||||
std::string tag = getName(transaction);
|
||||
ms_dbg_a(transaction, 9, "Rule tag: " + tag);
|
||||
|
@ -38,7 +38,7 @@ class Tag : public Action {
|
||||
|
||||
std::string getName(Transaction *transaction);
|
||||
|
||||
bool evaluate(RuleWithActions *rule, Transaction *transaction,
|
||||
bool execute(RuleWithActions *rule, Transaction *transaction,
|
||||
RuleMessage &rm) override;
|
||||
|
||||
protected:
|
||||
|
@ -32,7 +32,7 @@ namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
|
||||
std::string Base64Decode::evaluate(const std::string &value,
|
||||
std::string Base64Decode::execute(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
std::string ret = Utils::Base64::decode(value);
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Base64Decode : public Transformation {
|
||||
public:
|
||||
explicit Base64Decode(const std::string &action) : Transformation(action) { }
|
||||
|
||||
std::string evaluate(const std::string &exp,
|
||||
std::string execute(const std::string &exp,
|
||||
Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
|
||||
std::string Base64DecodeExt::evaluate(const std::string &value,
|
||||
std::string Base64DecodeExt::execute(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
std::string ret = Utils::Base64::decode_forgiven(value);
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Base64DecodeExt : public Transformation {
|
||||
public:
|
||||
explicit Base64DecodeExt(const std::string &action) : Transformation(action) { }
|
||||
|
||||
std::string evaluate(const std::string &exp,
|
||||
std::string execute(const std::string &exp,
|
||||
Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
|
||||
std::string Base64Encode::evaluate(const std::string &value,
|
||||
std::string Base64Encode::execute(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
std::string ret = Utils::Base64::encode(value);
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Base64Encode : public Transformation {
|
||||
public:
|
||||
explicit Base64Encode(const std::string &action) : Transformation(action) { }
|
||||
|
||||
std::string evaluate(const std::string &exp,
|
||||
std::string execute(const std::string &exp,
|
||||
Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
|
||||
std::string CmdLine::evaluate(const std::string &value,
|
||||
std::string CmdLine::execute(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
std::string ret;
|
||||
int space = 0;
|
||||
|
@ -33,7 +33,7 @@ class CmdLine : public Transformation {
|
||||
explicit CmdLine(const std::string &action)
|
||||
: Transformation(action) { }
|
||||
|
||||
std::string evaluate(const std::string &exp,
|
||||
std::string execute(const std::string &exp,
|
||||
Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ CompressWhitespace::CompressWhitespace(const std::string &action)
|
||||
this->action_kind = 1;
|
||||
}
|
||||
|
||||
std::string CompressWhitespace::evaluate(const std::string &value,
|
||||
std::string CompressWhitespace::execute(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
|
||||
std::string a;
|
||||
|
@ -30,10 +30,9 @@ namespace transformations {
|
||||
|
||||
class CompressWhitespace : public Transformation {
|
||||
public:
|
||||
|
||||
explicit CompressWhitespace(const std::string &action) ;
|
||||
|
||||
std::string evaluate(const std::string &exp,
|
||||
std::string execute(const std::string &exp,
|
||||
Transaction *transaction) override;
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
|
||||
std::string CssDecode::evaluate(const std::string &value,
|
||||
std::string CssDecode::execute(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
|
||||
char *tmp = reinterpret_cast<char *>(
|
||||
|
@ -33,7 +33,7 @@ class CssDecode : public Transformation {
|
||||
public:
|
||||
explicit CssDecode(const std::string &action)
|
||||
: Transformation(action) { }
|
||||
std::string evaluate(const std::string &exp,
|
||||
std::string execute(const std::string &exp,
|
||||
Transaction *transaction) override;
|
||||
|
||||
static int css_decode_inplace(unsigned char *input, int64_t input_len);
|
||||
|
@ -140,7 +140,7 @@ int EscapeSeqDecode::ansi_c_sequences_decode_inplace(unsigned char *input,
|
||||
}
|
||||
|
||||
|
||||
std::string EscapeSeqDecode::evaluate(const std::string &value,
|
||||
std::string EscapeSeqDecode::execute(const std::string &value,
|
||||
Transaction *transaction) {
|
||||
|
||||
unsigned char *tmp = (unsigned char *) malloc(sizeof(char)
|
||||
|
@ -30,10 +30,8 @@ namespace transformations {
|
||||
|
||||
class EscapeSeqDecode : public Transformation {
|
||||
public:
|
||||
|
||||
explicit EscapeSeqDecode(const std::string &action) ;
|
||||
|
||||
std::string evaluate(const std::string &exp,
|
||||
std::string execute(const std::string &exp,
|
||||
Transaction *transaction) override;
|
||||
static int ansi_c_sequences_decode_inplace(unsigned char *input, int input_len);
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user