mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Removes method isDisruptive from Action class
This commit is contained in:
parent
bc3ad6e049
commit
f8d56f64f1
@ -75,11 +75,6 @@ class Action {
|
||||
}
|
||||
|
||||
|
||||
virtual bool isDisruptive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const std::string *getName() const noexcept {
|
||||
return &m_name;
|
||||
}
|
||||
|
@ -31,9 +31,6 @@ namespace disruptive {
|
||||
|
||||
class ActionDisruptive : public ActionAllowedAsSecDefaultAction {
|
||||
public:
|
||||
bool isDisruptive() override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1180,7 +1180,8 @@ expression:
|
||||
int secRuleDefinedPhase = -1;
|
||||
for (actions::Action *a : *actions) {
|
||||
actions::Phase *phase = dynamic_cast<actions::Phase *>(a);
|
||||
if (a->isDisruptive() == true && dynamic_cast<actions::Block *>(a) == NULL) {
|
||||
if (dynamic_cast<actions::disruptive::ActionDisruptive *>(a) != NULL
|
||||
&& dynamic_cast<actions::Block *>(a) == NULL) {
|
||||
hasDisruptive = true;
|
||||
}
|
||||
if (phase != NULL) {
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "src/actions/set_var.h"
|
||||
#include "src/actions/severity.h"
|
||||
#include "src/actions/tag.h"
|
||||
#include "src/actions/disruptive/disruptive_action.h"
|
||||
#include "src/actions/transformations/transformation.h"
|
||||
#include "src/actions/transformations/none.h"
|
||||
#include "src/actions/xmlns.h"
|
||||
@ -142,7 +143,7 @@ void RuleWithActions::addDefaultAction(std::shared_ptr<actions::Action> a) {
|
||||
} else if (dynamic_cast<actions::Block *>(a.get())) {
|
||||
m_defaultActionActionsRuntimePos.push_back(a);
|
||||
m_defaultContainsStaticBlockAction = true;
|
||||
} else if (a->isDisruptive() == true) {
|
||||
} else if (std::dynamic_pointer_cast<actions::disruptive::ActionDisruptive>(a) != NULL) {
|
||||
m_defaultActionDisruptiveAction = a;
|
||||
} else {
|
||||
m_defaultActionActionsRuntimePos.push_back(a);
|
||||
@ -179,7 +180,7 @@ void RuleWithActions::addAction(actions::Action *a) {
|
||||
m_containsStaticBlockAction = true;
|
||||
} else if (dynamic_cast<actions::XmlNS *>(a)) {
|
||||
m_XmlNSs.push_back(std::unique_ptr<actions::XmlNS>(dynamic_cast<actions::XmlNS *>(a)));
|
||||
} else if (a->isDisruptive() == true) {
|
||||
} else if (dynamic_cast<actions::disruptive::ActionDisruptive *>(a) != NULL) {
|
||||
m_disruptiveAction = std::unique_ptr<Action>(a);
|
||||
} else {
|
||||
m_actionsRuntimePos.push_back(std::unique_ptr<Action>(a));
|
||||
@ -241,16 +242,16 @@ void RuleWithActions::executeActionsAfterFullMatch(Transaction *trans) {
|
||||
continue;
|
||||
}
|
||||
actions::Action *a = dynamic_cast<actions::Action*>(b.second.get());
|
||||
if (a->isDisruptive()) {
|
||||
if (dynamic_cast<actions::disruptive::ActionDisruptive *>(a) != NULL) {
|
||||
trans->messageGetLast()->setRule(this);
|
||||
}
|
||||
executeAction(trans, a, false);
|
||||
if (a->isDisruptive()) {
|
||||
if (dynamic_cast<actions::disruptive::ActionDisruptive *>(a) != NULL) {
|
||||
disruptiveAlreadyExecuted = true;
|
||||
}
|
||||
}
|
||||
for (auto &a : getMatchActionsPtr()) {
|
||||
if (!a->isDisruptive()
|
||||
if (!dynamic_cast<actions::disruptive::ActionDisruptive *>(a) != NULL
|
||||
&& !(disruptiveAlreadyExecuted
|
||||
&& dynamic_cast<actions::Block *>(a))) {
|
||||
executeAction(trans, a, false);
|
||||
@ -270,7 +271,7 @@ void RuleWithActions::executeActionsAfterFullMatch(Transaction *trans) {
|
||||
|
||||
void RuleWithActions::executeAction(Transaction *trans,
|
||||
Action *a, bool defaultContext) {
|
||||
if (a->isDisruptive() == false) {
|
||||
if (dynamic_cast<actions::disruptive::ActionDisruptive *>(a) == NULL) {
|
||||
ms_dbg_a(trans, 9, "Running action: " + *a->getName());
|
||||
a->execute(trans);
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user