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