mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Adds initial support to the multiMatch action
This commit is contained in:
parent
9116a19bcc
commit
8fa0523fe0
@ -104,6 +104,7 @@ ACTIONS = \
|
|||||||
actions/log_data.cc \
|
actions/log_data.cc \
|
||||||
actions/maturity.cc \
|
actions/maturity.cc \
|
||||||
actions/msg.cc \
|
actions/msg.cc \
|
||||||
|
actions/multi_match.cc \
|
||||||
actions/no_audit_log.cc \
|
actions/no_audit_log.cc \
|
||||||
actions/no_log.cc \
|
actions/no_log.cc \
|
||||||
actions/pass.cc \
|
actions/pass.cc \
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "modsecurity/transaction.h"
|
#include "modsecurity/transaction.h"
|
||||||
#include "modsecurity/rule.h"
|
#include "modsecurity/rule.h"
|
||||||
|
#include "src/utils/string.h"
|
||||||
|
|
||||||
#include "src/actions/block.h"
|
#include "src/actions/block.h"
|
||||||
#include "src/actions/chain.h"
|
#include "src/actions/chain.h"
|
||||||
@ -33,7 +34,7 @@
|
|||||||
#include "src/actions/pass.h"
|
#include "src/actions/pass.h"
|
||||||
#include "src/actions/log.h"
|
#include "src/actions/log.h"
|
||||||
#include "src/actions/no_log.h"
|
#include "src/actions/no_log.h"
|
||||||
|
#include "src/actions/multi_match.h"
|
||||||
|
|
||||||
|
|
||||||
#define IF_MATCH(a) \
|
#define IF_MATCH(a) \
|
||||||
@ -97,6 +98,9 @@ Action *Action::instantiate(const std::string& name) {
|
|||||||
if (name == "nolog") {
|
if (name == "nolog") {
|
||||||
return new NoLog(name);
|
return new NoLog(name);
|
||||||
}
|
}
|
||||||
|
if (utils::string::tolower(name) == "multimatch") {
|
||||||
|
return new MultiMatch(utils::string::tolower(name));
|
||||||
|
}
|
||||||
return new Action(name);
|
return new Action(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
34
src/actions/multi_match.cc
Normal file
34
src/actions/multi_match.cc
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* ModSecurity, http://www.modsecurity.org/
|
||||||
|
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||||
|
*
|
||||||
|
* You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* If any of the files related to licensing are missing or if you have any
|
||||||
|
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||||
|
* directly using the email address security@modsecurity.org.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "src/actions/multi_match.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "modsecurity/transaction.h"
|
||||||
|
#include "modsecurity/rule.h"
|
||||||
|
|
||||||
|
namespace modsecurity {
|
||||||
|
namespace actions {
|
||||||
|
|
||||||
|
|
||||||
|
bool MultiMatch::evaluate(Rule *rule, Transaction *transaction) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace actions
|
||||||
|
} // namespace modsecurity
|
45
src/actions/multi_match.h
Normal file
45
src/actions/multi_match.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* ModSecurity, http://www.modsecurity.org/
|
||||||
|
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||||
|
*
|
||||||
|
* You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* If any of the files related to licensing are missing or if you have any
|
||||||
|
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||||
|
* directly using the email address security@modsecurity.org.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "modsecurity/actions/action.h"
|
||||||
|
|
||||||
|
#ifndef SRC_ACTIONS_MULTI_MATCH_H_
|
||||||
|
#define SRC_ACTIONS_MULTI_MATCH_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
class Transaction;
|
||||||
|
|
||||||
|
namespace modsecurity {
|
||||||
|
class Transaction;
|
||||||
|
class Rule;
|
||||||
|
|
||||||
|
namespace actions {
|
||||||
|
|
||||||
|
|
||||||
|
class MultiMatch : public Action {
|
||||||
|
public:
|
||||||
|
explicit MultiMatch(std::string action)
|
||||||
|
: Action(action, RunTimeOnlyIfMatchKind) { }
|
||||||
|
|
||||||
|
bool evaluate(Rule *rule, Transaction *transaction) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace actions
|
||||||
|
} // namespace modsecurity
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // SRC_ACTIONS_MULTI_MATCH_H_
|
Loading…
x
Reference in New Issue
Block a user