mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 01:22:18 +03:00
Refactoring: Renames RulesProperties to RulesSetProperties
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
#ifndef HEADERS_MODSECURITY_RULES_H_
|
||||
#define HEADERS_MODSECURITY_RULES_H_
|
||||
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "modsecurity/transaction.h"
|
||||
|
||||
@@ -42,10 +42,10 @@ class Driver;
|
||||
|
||||
|
||||
/** @ingroup ModSecurity_CPP_API */
|
||||
class RulesSet : public RulesProperties {
|
||||
class RulesSet : public RulesSetProperties {
|
||||
public:
|
||||
RulesSet()
|
||||
: RulesProperties(new DebugLog()),
|
||||
: RulesSetProperties(new DebugLog()),
|
||||
unicode_codepage(0),
|
||||
#ifndef NO_LOGS
|
||||
m_secmarker_skipped(0),
|
||||
@@ -53,7 +53,7 @@ class RulesSet : public RulesProperties {
|
||||
m_referenceCount(0) { }
|
||||
|
||||
explicit RulesSet(DebugLog *customLog)
|
||||
: RulesProperties(customLog),
|
||||
: RulesSetProperties(customLog),
|
||||
unicode_codepage(0),
|
||||
#ifndef NO_LOGS
|
||||
m_secmarker_skipped(0),
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HEADERS_MODSECURITY_RULES_PROPERTIES_H_
|
||||
#define HEADERS_MODSECURITY_RULES_PROPERTIES_H_
|
||||
#ifndef HEADERS_MODSECURITY_RULES_SET_PROPERTIES_H_
|
||||
#define HEADERS_MODSECURITY_RULES_SET_PROPERTIES_H_
|
||||
|
||||
|
||||
#include "modsecurity/modsecurity.h"
|
||||
@@ -140,7 +140,7 @@ class UnicodeMapHolder {
|
||||
};
|
||||
|
||||
|
||||
class RulesProperties;
|
||||
class RulesSetProperties;
|
||||
class ConfigUnicodeMap {
|
||||
public:
|
||||
ConfigUnicodeMap() : m_set(false),
|
||||
@@ -148,7 +148,7 @@ class ConfigUnicodeMap {
|
||||
m_unicodeMapTable(NULL) { }
|
||||
|
||||
static void loadConfig(std::string f, double codePage,
|
||||
RulesProperties *driver, std::string *errg);
|
||||
RulesSetProperties *driver, std::string *errg);
|
||||
|
||||
void merge(ConfigUnicodeMap *from) {
|
||||
if (from->m_set == false) {
|
||||
@@ -168,9 +168,9 @@ class ConfigUnicodeMap {
|
||||
};
|
||||
|
||||
|
||||
class RulesProperties {
|
||||
class RulesSetProperties {
|
||||
public:
|
||||
RulesProperties() :
|
||||
RulesSetProperties() :
|
||||
m_auditLog(new AuditLog()),
|
||||
m_requestBodyLimitAction(PropertyNotSetBodyLimitAction),
|
||||
m_responseBodyLimitAction(PropertyNotSetBodyLimitAction),
|
||||
@@ -184,7 +184,7 @@ class RulesProperties {
|
||||
m_secRuleEngine(PropertyNotSetRuleEngine) { }
|
||||
|
||||
|
||||
explicit RulesProperties(DebugLog *debugLog) :
|
||||
explicit RulesSetProperties(DebugLog *debugLog) :
|
||||
m_auditLog(new AuditLog()),
|
||||
m_requestBodyLimitAction(PropertyNotSetBodyLimitAction),
|
||||
m_responseBodyLimitAction(PropertyNotSetBodyLimitAction),
|
||||
@@ -198,7 +198,7 @@ class RulesProperties {
|
||||
m_secRuleEngine(PropertyNotSetRuleEngine) { }
|
||||
|
||||
|
||||
~RulesProperties() {
|
||||
~RulesSetProperties() {
|
||||
int i = 0;
|
||||
/** Cleanup the rules */
|
||||
for (i = 0; i < modsecurity::Phases::NUMBER_OF_PHASES; i++) {
|
||||
@@ -350,7 +350,7 @@ class RulesProperties {
|
||||
}
|
||||
|
||||
|
||||
static int mergeProperties(RulesProperties *from, RulesProperties *to,
|
||||
static int mergeProperties(RulesSetProperties *from, RulesSetProperties *to,
|
||||
std::ostringstream *err) {
|
||||
int amount_of_rules = 0;
|
||||
|
||||
@@ -558,4 +558,4 @@ class RulesProperties {
|
||||
} // namespace modsecurity
|
||||
#endif
|
||||
|
||||
#endif // HEADERS_MODSECURITY_RULES_PROPERTIES_H_
|
||||
#endif // HEADERS_MODSECURITY_RULES_SET_PROPERTIES_H_
|
||||
@@ -44,8 +44,8 @@ pkginclude_HEADERS = \
|
||||
../headers/modsecurity/rule.h \
|
||||
../headers/modsecurity/rule_message.h \
|
||||
../headers/modsecurity/rules_set.h \
|
||||
../headers/modsecurity/rules_set_properties.h \
|
||||
../headers/modsecurity/rules_exceptions.h \
|
||||
../headers/modsecurity/rules_properties.h \
|
||||
../headers/modsecurity/transaction.h \
|
||||
../headers/modsecurity/variable_origin.h \
|
||||
../headers/modsecurity/variable_value.h
|
||||
@@ -271,7 +271,8 @@ libmodsecurity_la_SOURCES = \
|
||||
audit_log/writer/serial.cc \
|
||||
audit_log/writer/parallel.cc \
|
||||
modsecurity.cc \
|
||||
rules.cc \
|
||||
rules_set.cc \
|
||||
rules_set_properties.cc \
|
||||
debug_log/debug_log.cc \
|
||||
debug_log/debug_log_writer.cc \
|
||||
run_time_string.cc \
|
||||
@@ -280,7 +281,6 @@ libmodsecurity_la_SOURCES = \
|
||||
rule_script.cc \
|
||||
unique_id.cc \
|
||||
rules_exceptions.cc \
|
||||
rules_properties.cc \
|
||||
${BODY_PROCESSORS} \
|
||||
${ACTIONS} \
|
||||
${ENGINES} \
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/transaction.h"
|
||||
|
||||
namespace modsecurity {
|
||||
@@ -44,9 +44,9 @@ bool RequestBodyAccess::init(std::string *error) {
|
||||
|
||||
bool RequestBodyAccess::evaluate(Rule *rule, Transaction *transaction) {
|
||||
if (m_request_body_access) {
|
||||
transaction->m_requestBodyAccess = RulesProperties::TrueConfigBoolean;
|
||||
transaction->m_requestBodyAccess = RulesSetProperties::TrueConfigBoolean;
|
||||
} else {
|
||||
transaction->m_requestBodyAccess = RulesProperties::FalseConfigBoolean;
|
||||
transaction->m_requestBodyAccess = RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/rules_set.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/transaction.h"
|
||||
|
||||
namespace modsecurity {
|
||||
@@ -31,11 +31,11 @@ bool RuleEngine::init(std::string *error) {
|
||||
std::string what(m_parser_payload, 11, m_parser_payload.size() - 11);
|
||||
|
||||
if (what == "on") {
|
||||
m_ruleEngine = RulesProperties::EnabledRuleEngine;
|
||||
m_ruleEngine = RulesSetProperties::EnabledRuleEngine;
|
||||
} else if (what == "off") {
|
||||
m_ruleEngine = RulesProperties::DisabledRuleEngine;
|
||||
m_ruleEngine = RulesSetProperties::DisabledRuleEngine;
|
||||
} else if (what == "detectiononly") {
|
||||
m_ruleEngine = RulesProperties::DetectionOnlyRuleEngine;
|
||||
m_ruleEngine = RulesSetProperties::DetectionOnlyRuleEngine;
|
||||
} else {
|
||||
error->assign("Internal error. Expected: On, Off or DetectionOnly; " \
|
||||
"got: " + m_parser_payload);
|
||||
@@ -48,7 +48,7 @@ bool RuleEngine::init(std::string *error) {
|
||||
bool RuleEngine::evaluate(Rule *rule, Transaction *transaction) {
|
||||
std::stringstream a;
|
||||
a << "Setting SecRuleEngine to ";
|
||||
a << modsecurity::RulesProperties::ruleEngineStateString(m_ruleEngine);
|
||||
a << modsecurity::RulesSetProperties::ruleEngineStateString(m_ruleEngine);
|
||||
a << " as requested by a ctl:ruleEngine action";
|
||||
|
||||
ms_dbg_a(transaction, 8, a.str());
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/actions/action.h"
|
||||
#include "modsecurity/transaction.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
|
||||
|
||||
#ifndef SRC_ACTIONS_CTL_RULE_ENGINE_H_
|
||||
@@ -32,12 +32,12 @@ class RuleEngine : public Action {
|
||||
public:
|
||||
explicit RuleEngine(std::string action)
|
||||
: Action(action, RunTimeOnlyIfMatchKind),
|
||||
m_ruleEngine(RulesProperties::PropertyNotSetRuleEngine) { }
|
||||
m_ruleEngine(RulesSetProperties::PropertyNotSetRuleEngine) { }
|
||||
|
||||
bool init(std::string *error) override;
|
||||
bool evaluate(Rule *rule, Transaction *transaction) override;
|
||||
|
||||
RulesProperties::RuleEngine m_ruleEngine;
|
||||
RulesSetProperties::RuleEngine m_ruleEngine;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
#include <locale>
|
||||
#include <cstring>
|
||||
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/rules_set.h"
|
||||
#include "modsecurity/transaction.h"
|
||||
#include "src/actions/transformations/transformation.h"
|
||||
#include "src/utils/string.h"
|
||||
#include "src/utils/system.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/actions/action.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "src/actions/transformations/transformation.h"
|
||||
|
||||
#ifndef SRC_ACTIONS_TRANSFORMATIONS_URL_DECODE_UNI_H_
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
#include "src/parser/driver.h"
|
||||
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "src/parser/seclang-parser.hh"
|
||||
#include "modsecurity/audit_log.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
|
||||
using modsecurity::audit_log::AuditLog;
|
||||
using modsecurity::Rule;
|
||||
@@ -26,7 +26,7 @@ namespace modsecurity {
|
||||
namespace Parser {
|
||||
|
||||
Driver::Driver()
|
||||
: RulesProperties(),
|
||||
: RulesSetProperties(),
|
||||
trace_scanning(false),
|
||||
trace_parsing(false),
|
||||
lastRule(NULL) { }
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "modsecurity/rules_set.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/audit_log.h"
|
||||
#include "src/rule_script.h"
|
||||
#include "src/parser/seclang-parser.hh"
|
||||
@@ -50,7 +50,7 @@ typedef struct Driver_t Driver;
|
||||
#endif
|
||||
|
||||
|
||||
class Driver : public RulesProperties {
|
||||
class Driver : public RulesSetProperties {
|
||||
public:
|
||||
Driver();
|
||||
virtual ~Driver();
|
||||
|
||||
@@ -1585,7 +1585,7 @@ namespace yy {
|
||||
case 21:
|
||||
#line 839 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_uploadKeepFiles = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_uploadKeepFiles = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
#line 1591 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -1593,7 +1593,7 @@ namespace yy {
|
||||
case 22:
|
||||
#line 843 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_uploadKeepFiles = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_uploadKeepFiles = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
#line 1599 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -1637,7 +1637,7 @@ namespace yy {
|
||||
case 27:
|
||||
#line 867 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_tmpSaveUploadedFiles = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_tmpSaveUploadedFiles = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
#line 1643 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -1645,7 +1645,7 @@ namespace yy {
|
||||
case 28:
|
||||
#line 871 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_tmpSaveUploadedFiles = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_tmpSaveUploadedFiles = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
#line 1651 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -2225,7 +2225,7 @@ namespace yy {
|
||||
case 82:
|
||||
#line 1255 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_secRequestBodyAccess = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_secRequestBodyAccess = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
#line 2231 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -2233,7 +2233,7 @@ namespace yy {
|
||||
case 83:
|
||||
#line 1259 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_secRequestBodyAccess = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_secRequestBodyAccess = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
#line 2239 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -2241,7 +2241,7 @@ namespace yy {
|
||||
case 84:
|
||||
#line 1263 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_secResponseBodyAccess = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_secResponseBodyAccess = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
#line 2247 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -2249,7 +2249,7 @@ namespace yy {
|
||||
case 85:
|
||||
#line 1267 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_secResponseBodyAccess = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_secResponseBodyAccess = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
#line 2255 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -2848,7 +2848,7 @@ namespace yy {
|
||||
case 140:
|
||||
#line 1667 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_secXMLExternalEntity = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_secXMLExternalEntity = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
#line 2854 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
@@ -2856,7 +2856,7 @@ namespace yy {
|
||||
case 141:
|
||||
#line 1671 "seclang-parser.yy" // lalr1.cc:906
|
||||
{
|
||||
driver.m_secXMLExternalEntity = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_secXMLExternalEntity = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
#line 2862 "seclang-parser.cc" // lalr1.cc:906
|
||||
break;
|
||||
|
||||
@@ -186,7 +186,7 @@ class Driver;
|
||||
|
||||
#include "modsecurity/audit_log.h"
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/rule.h"
|
||||
#include "src/operators/operator.h"
|
||||
#include "src/utils/geo_lookup.h"
|
||||
|
||||
@@ -148,7 +148,7 @@ class Driver;
|
||||
|
||||
#include "modsecurity/audit_log.h"
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/rule.h"
|
||||
#include "src/operators/operator.h"
|
||||
#include "src/utils/geo_lookup.h"
|
||||
@@ -837,11 +837,11 @@ audit_log:
|
||||
/* Upload */
|
||||
| CONFIG_UPDLOAD_KEEP_FILES CONFIG_VALUE_ON
|
||||
{
|
||||
driver.m_uploadKeepFiles = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_uploadKeepFiles = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
| CONFIG_UPDLOAD_KEEP_FILES CONFIG_VALUE_OFF
|
||||
{
|
||||
driver.m_uploadKeepFiles = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_uploadKeepFiles = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
| CONFIG_UPDLOAD_KEEP_FILES CONFIG_VALUE_RELEVANT_ONLY
|
||||
{
|
||||
@@ -865,11 +865,11 @@ audit_log:
|
||||
}
|
||||
| CONFIG_UPDLOAD_SAVE_TMP_FILES CONFIG_VALUE_ON
|
||||
{
|
||||
driver.m_tmpSaveUploadedFiles = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_tmpSaveUploadedFiles = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
| CONFIG_UPDLOAD_SAVE_TMP_FILES CONFIG_VALUE_OFF
|
||||
{
|
||||
driver.m_tmpSaveUploadedFiles = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_tmpSaveUploadedFiles = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
;
|
||||
|
||||
@@ -1241,31 +1241,31 @@ expression:
|
||||
}
|
||||
| CONFIG_DIR_RULE_ENG CONFIG_VALUE_OFF
|
||||
{
|
||||
driver.m_secRuleEngine = modsecurity::Rules::DisabledRuleEngine;
|
||||
driver.m_secRuleEngine = modsecurity::RulesSet::DisabledRuleEngine;
|
||||
}
|
||||
| CONFIG_DIR_RULE_ENG CONFIG_VALUE_ON
|
||||
{
|
||||
driver.m_secRuleEngine = modsecurity::Rules::EnabledRuleEngine;
|
||||
driver.m_secRuleEngine = modsecurity::RulesSet::EnabledRuleEngine;
|
||||
}
|
||||
| CONFIG_DIR_RULE_ENG CONFIG_VALUE_DETC
|
||||
{
|
||||
driver.m_secRuleEngine = modsecurity::Rules::DetectionOnlyRuleEngine;
|
||||
driver.m_secRuleEngine = modsecurity::RulesSet::DetectionOnlyRuleEngine;
|
||||
}
|
||||
| CONFIG_DIR_REQ_BODY CONFIG_VALUE_ON
|
||||
{
|
||||
driver.m_secRequestBodyAccess = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_secRequestBodyAccess = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
| CONFIG_DIR_REQ_BODY CONFIG_VALUE_OFF
|
||||
{
|
||||
driver.m_secRequestBodyAccess = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_secRequestBodyAccess = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
| CONFIG_DIR_RES_BODY CONFIG_VALUE_ON
|
||||
{
|
||||
driver.m_secResponseBodyAccess = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_secResponseBodyAccess = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
| CONFIG_DIR_RES_BODY CONFIG_VALUE_OFF
|
||||
{
|
||||
driver.m_secResponseBodyAccess = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_secResponseBodyAccess = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
| CONFIG_SEC_ARGUMENT_SEPARATOR
|
||||
{
|
||||
@@ -1613,27 +1613,27 @@ expression:
|
||||
}
|
||||
| CONFIG_DIR_REQ_BODY_LIMIT_ACTION CONFIG_VALUE_PROCESS_PARTIAL
|
||||
{
|
||||
driver.m_requestBodyLimitAction = modsecurity::Rules::BodyLimitAction::ProcessPartialBodyLimitAction;
|
||||
driver.m_requestBodyLimitAction = modsecurity::RulesSet::BodyLimitAction::ProcessPartialBodyLimitAction;
|
||||
}
|
||||
| CONFIG_DIR_REQ_BODY_LIMIT_ACTION CONFIG_VALUE_REJECT
|
||||
{
|
||||
driver.m_requestBodyLimitAction = modsecurity::Rules::BodyLimitAction::RejectBodyLimitAction;
|
||||
driver.m_requestBodyLimitAction = modsecurity::RulesSet::BodyLimitAction::RejectBodyLimitAction;
|
||||
}
|
||||
| CONFIG_DIR_RES_BODY_LIMIT_ACTION CONFIG_VALUE_PROCESS_PARTIAL
|
||||
{
|
||||
driver.m_responseBodyLimitAction = modsecurity::Rules::BodyLimitAction::ProcessPartialBodyLimitAction;
|
||||
driver.m_responseBodyLimitAction = modsecurity::RulesSet::BodyLimitAction::ProcessPartialBodyLimitAction;
|
||||
}
|
||||
| CONFIG_DIR_RES_BODY_LIMIT_ACTION CONFIG_VALUE_REJECT
|
||||
{
|
||||
driver.m_responseBodyLimitAction = modsecurity::Rules::BodyLimitAction::RejectBodyLimitAction;
|
||||
driver.m_responseBodyLimitAction = modsecurity::RulesSet::BodyLimitAction::RejectBodyLimitAction;
|
||||
}
|
||||
| CONFIG_SEC_REMOTE_RULES_FAIL_ACTION CONFIG_VALUE_ABORT
|
||||
{
|
||||
driver.m_remoteRulesActionOnFailed = Rules::OnFailedRemoteRulesAction::AbortOnFailedRemoteRulesAction;
|
||||
driver.m_remoteRulesActionOnFailed = RulesSet::OnFailedRemoteRulesAction::AbortOnFailedRemoteRulesAction;
|
||||
}
|
||||
| CONFIG_SEC_REMOTE_RULES_FAIL_ACTION CONFIG_VALUE_WARN
|
||||
{
|
||||
driver.m_remoteRulesActionOnFailed = Rules::OnFailedRemoteRulesAction::WarnOnFailedRemoteRulesAction;
|
||||
driver.m_remoteRulesActionOnFailed = RulesSet::OnFailedRemoteRulesAction::WarnOnFailedRemoteRulesAction;
|
||||
}
|
||||
| CONFIG_DIR_PCRE_MATCH_LIMIT_RECURSION
|
||||
/* Parser error disabled to avoid breaking default installations with modsecurity.conf-recommended
|
||||
@@ -1665,11 +1665,11 @@ expression:
|
||||
}
|
||||
| CONFIG_XML_EXTERNAL_ENTITY CONFIG_VALUE_OFF
|
||||
{
|
||||
driver.m_secXMLExternalEntity = modsecurity::RulesProperties::FalseConfigBoolean;
|
||||
driver.m_secXMLExternalEntity = modsecurity::RulesSetProperties::FalseConfigBoolean;
|
||||
}
|
||||
| CONFIG_XML_EXTERNAL_ENTITY CONFIG_VALUE_ON
|
||||
{
|
||||
driver.m_secXMLExternalEntity = modsecurity::RulesProperties::TrueConfigBoolean;
|
||||
driver.m_secXMLExternalEntity = modsecurity::RulesSetProperties::TrueConfigBoolean;
|
||||
}
|
||||
| CONGIG_DIR_SEC_TMP_DIR
|
||||
{
|
||||
|
||||
@@ -1308,10 +1308,10 @@ EQUALS_MINUS (?i:=\-)
|
||||
|
||||
if (ret == false) {
|
||||
BEGIN(INITIAL);
|
||||
if (driver.m_remoteRulesActionOnFailed == Rules::OnFailedRemoteRulesAction::WarnOnFailedRemoteRulesAction) {
|
||||
if (driver.m_remoteRulesActionOnFailed == RulesSet::OnFailedRemoteRulesAction::WarnOnFailedRemoteRulesAction) {
|
||||
/** TODO: Implement the server logging mechanism. */
|
||||
}
|
||||
if (driver.m_remoteRulesActionOnFailed == Rules::OnFailedRemoteRulesAction::AbortOnFailedRemoteRulesAction) {
|
||||
if (driver.m_remoteRulesActionOnFailed == RulesSet::OnFailedRemoteRulesAction::AbortOnFailedRemoteRulesAction) {
|
||||
driver.error (*driver.loc.back(), "", yytext + std::string(" - Failed to download: ") + c.error);
|
||||
throw p::syntax_error(*driver.loc.back(), "");
|
||||
}
|
||||
|
||||
@@ -71,12 +71,12 @@ Multipart::Multipart(std:: string header, Transaction *transaction)
|
||||
Multipart::~Multipart() {
|
||||
ms_dbg_a(m_transaction, 4,
|
||||
"Multipart: Cleanup started (remove files " \
|
||||
+ RulesProperties::configBooleanString(
|
||||
+ RulesSetProperties::configBooleanString(
|
||||
m_transaction->m_rules->m_uploadKeepFiles) \
|
||||
+ ")");
|
||||
|
||||
if (m_transaction->m_rules->m_uploadKeepFiles
|
||||
!= RulesProperties::TrueConfigBoolean) {
|
||||
!= RulesSetProperties::TrueConfigBoolean) {
|
||||
for (MultipartPart *m : m_parts) {
|
||||
if (m->m_type == MULTIPART_FILE) {
|
||||
if (!m->m_tmp_file_name.empty()) {
|
||||
@@ -462,9 +462,9 @@ int Multipart::process_part_data(std::string *error, size_t offset) {
|
||||
/* add data to the part we are building */
|
||||
if (m_mpp->m_type == MULTIPART_FILE) {
|
||||
bool extract = m_transaction->m_rules->m_uploadKeepFiles \
|
||||
== RulesProperties::TrueConfigBoolean \
|
||||
== RulesSetProperties::TrueConfigBoolean \
|
||||
|| m_transaction->m_rules->m_tmpSaveUploadedFiles \
|
||||
== RulesProperties::TrueConfigBoolean;
|
||||
== RulesSetProperties::TrueConfigBoolean;
|
||||
|
||||
/* remember where we started */
|
||||
if (m_mpp->m_length == 0) {
|
||||
|
||||
@@ -48,7 +48,7 @@ XML::~XML() {
|
||||
bool XML::init() {
|
||||
xmlParserInputBufferCreateFilenameFunc entity;
|
||||
if (m_transaction->m_rules->m_secXMLExternalEntity
|
||||
== RulesProperties::TrueConfigBoolean) {
|
||||
== RulesSetProperties::TrueConfigBoolean) {
|
||||
entity = xmlParserInputBufferCreateFilenameDefault(
|
||||
__xmlParserInputBufferCreateFilename);
|
||||
} else {
|
||||
|
||||
@@ -263,8 +263,8 @@ int RulesSet::evaluate(int phase, Transaction *t) {
|
||||
int RulesSet::merge(Driver *from) {
|
||||
int amount_of_rules = 0;
|
||||
amount_of_rules = mergeProperties(
|
||||
dynamic_cast<RulesProperties *>(from),
|
||||
dynamic_cast<RulesProperties *>(this),
|
||||
dynamic_cast<RulesSetProperties *>(from),
|
||||
dynamic_cast<RulesSetProperties *>(this),
|
||||
&m_parserError);
|
||||
|
||||
return amount_of_rules;
|
||||
@@ -274,8 +274,8 @@ int RulesSet::merge(Driver *from) {
|
||||
int RulesSet::merge(RulesSet *from) {
|
||||
int amount_of_rules = 0;
|
||||
amount_of_rules = mergeProperties(
|
||||
dynamic_cast<RulesProperties *>(from),
|
||||
dynamic_cast<RulesProperties *>(this),
|
||||
dynamic_cast<RulesSetProperties *>(from),
|
||||
dynamic_cast<RulesSetProperties *>(this),
|
||||
&m_parserError);
|
||||
|
||||
return amount_of_rules;
|
||||
@@ -13,10 +13,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "modsecurity/rules_properties.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "src/utils/string.h"
|
||||
#include "src/variables/variable.h"
|
||||
|
||||
@@ -24,7 +23,7 @@ namespace modsecurity {
|
||||
|
||||
|
||||
void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage,
|
||||
RulesProperties *driver, std::string *errg) {
|
||||
RulesSetProperties *driver, std::string *errg) {
|
||||
char *buf = NULL;
|
||||
char *hmap = NULL;
|
||||
char *p = NULL;
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "src/utils/random.h"
|
||||
#include "modsecurity/rule.h"
|
||||
#include "modsecurity/rule_message.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "src/actions/disruptive/allow.h"
|
||||
#include "src/variables/remote_user.h"
|
||||
|
||||
@@ -117,7 +117,7 @@ Transaction::Transaction(ModSecurity *ms, RulesSet *rules, void *logCbData)
|
||||
m_creationTimeStamp(utils::cpu_seconds()),
|
||||
m_logCbData(logCbData),
|
||||
m_ms(ms),
|
||||
m_secRuleEngine(RulesProperties::PropertyNotSetRuleEngine),
|
||||
m_secRuleEngine(RulesSetProperties::PropertyNotSetRuleEngine),
|
||||
m_collections(ms->m_global_collection, ms->m_ip_collection,
|
||||
ms->m_session_collection, ms->m_user_collection,
|
||||
ms->m_resource_collection),
|
||||
@@ -161,7 +161,7 @@ Transaction::Transaction(ModSecurity *ms, RulesSet *rules, char *id, void *logCb
|
||||
m_creationTimeStamp(utils::cpu_seconds()),
|
||||
m_logCbData(logCbData),
|
||||
m_ms(ms),
|
||||
m_secRuleEngine(RulesProperties::PropertyNotSetRuleEngine),
|
||||
m_secRuleEngine(RulesSetProperties::PropertyNotSetRuleEngine),
|
||||
m_collections(ms->m_global_collection, ms->m_ip_collection,
|
||||
ms->m_session_collection, ms->m_user_collection,
|
||||
ms->m_resource_collection),
|
||||
@@ -681,7 +681,7 @@ int Transaction::addRequestHeader(const unsigned char *key, size_t key_n,
|
||||
int Transaction::processRequestBody() {
|
||||
ms_dbg(4, "Starting phase REQUEST_BODY. (SecRules 2)");
|
||||
|
||||
if (getRuleEngineState() == RulesProperties::DisabledRuleEngine) {
|
||||
if (getRuleEngineState() == RulesSetProperties::DisabledRuleEngine) {
|
||||
ms_dbg(4, "Rule engine disabled, returning...");
|
||||
return true;
|
||||
}
|
||||
@@ -794,8 +794,8 @@ int Transaction::processRequestBody() {
|
||||
m_variableReqbodyProcessorError.set("0", m_variableOffset);
|
||||
}
|
||||
|
||||
if (m_rules->m_secRequestBodyAccess == RulesProperties::FalseConfigBoolean) {
|
||||
if (m_requestBodyAccess != RulesProperties::TrueConfigBoolean) {
|
||||
if (m_rules->m_secRequestBodyAccess == RulesSetProperties::FalseConfigBoolean) {
|
||||
if (m_requestBodyAccess != RulesSetProperties::TrueConfigBoolean) {
|
||||
ms_dbg(4, "Request body processing is disabled");
|
||||
return true;
|
||||
} else {
|
||||
@@ -804,7 +804,7 @@ int Transaction::processRequestBody() {
|
||||
"action");
|
||||
}
|
||||
} else {
|
||||
if (m_requestBodyAccess == RulesProperties::FalseConfigBoolean) {
|
||||
if (m_requestBodyAccess == RulesSetProperties::FalseConfigBoolean) {
|
||||
ms_dbg(4, "Request body processing is enabled, but " \
|
||||
"disabled to this transaction due to ctl:requestBodyAccess " \
|
||||
"action");
|
||||
@@ -1089,7 +1089,7 @@ int Transaction::processResponseBody() {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_rules->m_secResponseBodyAccess != RulesProperties::TrueConfigBoolean) {
|
||||
if (m_rules->m_secResponseBodyAccess != RulesSetProperties::TrueConfigBoolean) {
|
||||
ms_dbg(4, "Response body is disabled, returning... " + std::to_string(m_rules->m_secResponseBodyAccess));
|
||||
return true;
|
||||
}
|
||||
@@ -1627,7 +1627,7 @@ std::string Transaction::toJSON(int parts) {
|
||||
/* producer > engine state */
|
||||
LOGFY_ADD("secrules_engine",
|
||||
RulesSet::ruleEngineStateString(
|
||||
(RulesProperties::RuleEngine) getRuleEngineState()));
|
||||
(RulesSetProperties::RuleEngine) getRuleEngineState()));
|
||||
|
||||
/* producer > components */
|
||||
yajl_gen_string(g,
|
||||
@@ -1714,7 +1714,7 @@ void Transaction::serverLog(std::shared_ptr<RuleMessage> rm) {
|
||||
|
||||
|
||||
int Transaction::getRuleEngineState() {
|
||||
if (m_secRuleEngine == RulesProperties::PropertyNotSetRuleEngine) {
|
||||
if (m_secRuleEngine == RulesSetProperties::PropertyNotSetRuleEngine) {
|
||||
return m_rules->m_secRuleEngine;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "modsecurity/transaction.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/rules_set.h"
|
||||
|
||||
#include "src/request_body_processor/xml.h"
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "modsecurity/rules_set_properties.h"
|
||||
#include "modsecurity/rules_set.h"
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "src/utils/system.h"
|
||||
#include "src/parser/driver.h"
|
||||
#include "src/utils/https_client.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/transaction.h"
|
||||
|
||||
void print_help() {
|
||||
|
||||
Reference in New Issue
Block a user