mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-12-31 13:49:11 +03:00
Refactoring: Renames Rules to RulesSet
RulesSet does not only contain rules but alse properties
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#define SRC_PARSER_DRIVER_H_
|
||||
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "modsecurity/rules.h"
|
||||
#include "modsecurity/rules_set.h"
|
||||
#include "modsecurity/rules_properties.h"
|
||||
#include "modsecurity/audit_log.h"
|
||||
#include "src/rule_script.h"
|
||||
@@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
using modsecurity::Rule;
|
||||
using modsecurity::Rules;
|
||||
using modsecurity::RulesSet;
|
||||
|
||||
|
||||
# define YY_DECL \
|
||||
|
||||
@@ -2466,7 +2466,7 @@ namespace yy {
|
||||
case 80:
|
||||
#line 1210 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_secRuleEngine = modsecurity::Rules::DisabledRuleEngine;
|
||||
driver.m_secRuleEngine = modsecurity::RulesSet::DisabledRuleEngine;
|
||||
}
|
||||
#line 2472 "seclang-parser.cc"
|
||||
break;
|
||||
@@ -2474,7 +2474,7 @@ namespace yy {
|
||||
case 81:
|
||||
#line 1214 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_secRuleEngine = modsecurity::Rules::EnabledRuleEngine;
|
||||
driver.m_secRuleEngine = modsecurity::RulesSet::EnabledRuleEngine;
|
||||
}
|
||||
#line 2480 "seclang-parser.cc"
|
||||
break;
|
||||
@@ -2482,7 +2482,7 @@ namespace yy {
|
||||
case 82:
|
||||
#line 1218 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_secRuleEngine = modsecurity::Rules::DetectionOnlyRuleEngine;
|
||||
driver.m_secRuleEngine = modsecurity::RulesSet::DetectionOnlyRuleEngine;
|
||||
}
|
||||
#line 2488 "seclang-parser.cc"
|
||||
break;
|
||||
@@ -3039,7 +3039,7 @@ namespace yy {
|
||||
case 131:
|
||||
#line 1582 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_requestBodyLimitAction = modsecurity::Rules::BodyLimitAction::ProcessPartialBodyLimitAction;
|
||||
driver.m_requestBodyLimitAction = modsecurity::RulesSet::BodyLimitAction::ProcessPartialBodyLimitAction;
|
||||
}
|
||||
#line 3045 "seclang-parser.cc"
|
||||
break;
|
||||
@@ -3047,7 +3047,7 @@ namespace yy {
|
||||
case 132:
|
||||
#line 1586 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_requestBodyLimitAction = modsecurity::Rules::BodyLimitAction::RejectBodyLimitAction;
|
||||
driver.m_requestBodyLimitAction = modsecurity::RulesSet::BodyLimitAction::RejectBodyLimitAction;
|
||||
}
|
||||
#line 3053 "seclang-parser.cc"
|
||||
break;
|
||||
@@ -3055,7 +3055,7 @@ namespace yy {
|
||||
case 133:
|
||||
#line 1590 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_responseBodyLimitAction = modsecurity::Rules::BodyLimitAction::ProcessPartialBodyLimitAction;
|
||||
driver.m_responseBodyLimitAction = modsecurity::RulesSet::BodyLimitAction::ProcessPartialBodyLimitAction;
|
||||
}
|
||||
#line 3061 "seclang-parser.cc"
|
||||
break;
|
||||
@@ -3063,7 +3063,7 @@ namespace yy {
|
||||
case 134:
|
||||
#line 1594 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_responseBodyLimitAction = modsecurity::Rules::BodyLimitAction::RejectBodyLimitAction;
|
||||
driver.m_responseBodyLimitAction = modsecurity::RulesSet::BodyLimitAction::RejectBodyLimitAction;
|
||||
}
|
||||
#line 3069 "seclang-parser.cc"
|
||||
break;
|
||||
@@ -3071,7 +3071,7 @@ namespace yy {
|
||||
case 135:
|
||||
#line 1598 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_remoteRulesActionOnFailed = Rules::OnFailedRemoteRulesAction::AbortOnFailedRemoteRulesAction;
|
||||
driver.m_remoteRulesActionOnFailed = RulesSet::OnFailedRemoteRulesAction::AbortOnFailedRemoteRulesAction;
|
||||
}
|
||||
#line 3077 "seclang-parser.cc"
|
||||
break;
|
||||
@@ -3079,7 +3079,7 @@ namespace yy {
|
||||
case 136:
|
||||
#line 1602 "seclang-parser.yy"
|
||||
{
|
||||
driver.m_remoteRulesActionOnFailed = Rules::OnFailedRemoteRulesAction::WarnOnFailedRemoteRulesAction;
|
||||
driver.m_remoteRulesActionOnFailed = RulesSet::OnFailedRemoteRulesAction::WarnOnFailedRemoteRulesAction;
|
||||
}
|
||||
#line 3085 "seclang-parser.cc"
|
||||
break;
|
||||
|
||||
@@ -1208,15 +1208,15 @@ 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
|
||||
{
|
||||
@@ -1580,27 +1580,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
|
||||
|
||||
@@ -8535,10 +8535,10 @@ YY_RULE_SETUP
|
||||
|
||||
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(), "");
|
||||
}
|
||||
|
||||
@@ -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(), "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user