mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-12-31 13:49:11 +03:00
Update Regex util to support match limits
If the rx or rxGlobal operator encounters a regex error, the RX_ERROR and RX_ERROR_RULE_ID variables are set. RX_ERROR contains a simple error code which can be either OTHER or MATCH_LIMIT. RX_ERROR_RULE_ID unsurprisingly contains the ID of the rule associated with the error. More than one rule may encounter regex errors, but only the first error is reflected in these variables.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// A Bison parser, made by GNU Bison 3.7.6.
|
||||
// A Bison parser, made by GNU Bison 3.8.2.
|
||||
|
||||
// Locations for Bison parsers in C++
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// A Bison parser, made by GNU Bison 3.7.6.
|
||||
// A Bison parser, made by GNU Bison 3.8.2.
|
||||
|
||||
// Starting with Bison 3.2, this file is useless: the structure it
|
||||
// used to define is now defined in "location.hh".
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -235,6 +235,8 @@ class Driver;
|
||||
#include "src/variables/response_protocol.h"
|
||||
#include "src/variables/response_status.h"
|
||||
#include "src/variables/rule.h"
|
||||
#include "src/variables/rx_error.h"
|
||||
#include "src/variables/rx_error_rule_id.h"
|
||||
#include "src/variables/server_addr.h"
|
||||
#include "src/variables/server_name.h"
|
||||
#include "src/variables/server_port.h"
|
||||
@@ -411,6 +413,8 @@ using namespace modsecurity::operators;
|
||||
VARIABLE_RESPONSE_HEADERS_NAMES
|
||||
VARIABLE_RESPONSE_PROTOCOL "RESPONSE_PROTOCOL"
|
||||
VARIABLE_RESPONSE_STATUS "RESPONSE_STATUS"
|
||||
VARIABLE_RX_ERROR "RX_ERROR"
|
||||
VARIABLE_RX_ERROR_RULE_ID "RX_ERROR_RULE_ID"
|
||||
VARIABLE_SERVER_ADDR "SERVER_ADDR"
|
||||
VARIABLE_SERVER_NAME "SERVER_NAME"
|
||||
VARIABLE_SERVER_PORT "SERVER_PORT"
|
||||
@@ -1648,10 +1652,10 @@ expression:
|
||||
YYERROR;
|
||||
*/
|
||||
| CONFIG_DIR_PCRE_MATCH_LIMIT
|
||||
/* Parser error disabled to avoid breaking default installations with modsecurity.conf-recommended
|
||||
driver.error(@0, "SecPcreMatchLimit is not currently supported. Default PCRE values are being used for now");
|
||||
YYERROR;
|
||||
*/
|
||||
{
|
||||
driver.m_pcreMatchLimit.m_set = true;
|
||||
driver.m_pcreMatchLimit.m_value = atoi($1.c_str());
|
||||
}
|
||||
| CONGIG_DIR_RESPONSE_BODY_MP
|
||||
{
|
||||
std::istringstream buf($1);
|
||||
@@ -2477,6 +2481,14 @@ var:
|
||||
{
|
||||
VARIABLE_CONTAINER($$, new variables::ResponseStatus());
|
||||
}
|
||||
| VARIABLE_RX_ERROR
|
||||
{
|
||||
VARIABLE_CONTAINER($$, new variables::RxError());
|
||||
}
|
||||
| VARIABLE_RX_ERROR_RULE_ID
|
||||
{
|
||||
VARIABLE_CONTAINER($$, new variables::RxErrorRuleID());
|
||||
}
|
||||
| VARIABLE_SERVER_ADDR
|
||||
{
|
||||
VARIABLE_CONTAINER($$, new variables::ServerAddr());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -231,6 +231,8 @@ VARIABLE_RESPONSE_CONTENT_TYPE (?i:RESPONSE_CONTENT_TYPE)
|
||||
VARIABLE_RESPONSE_HEADERS_NAMES (?i:RESPONSE_HEADERS_NAMES)
|
||||
VARIABLE_RESPONSE_PROTOCOL (?i:RESPONSE_PROTOCOL)
|
||||
VARIABLE_RESPONSE_STATUS (?i:RESPONSE_STATUS)
|
||||
VARIABLE_RX_ERROR (?i:RX_ERROR)
|
||||
VARIABLE_RX_ERROR_RULE_ID (?i:RX_ERROR_RULE_ID)
|
||||
VARIABLE_SERVER_ADDR (?i:SERVER_ADDR)
|
||||
VARIABLE_SERVER_NAME (?i:SERVER_NAME)
|
||||
VARIABLE_SERVER_PORT (?i:SERVER_PORT)
|
||||
@@ -959,6 +961,8 @@ EQUALS_MINUS (?i:=\-)
|
||||
{VARIABLE_RESPONSE_HEADERS_NAMES}[:.] { BEGINX(EXPECTING_VAR_PARAMETER); return p::make_VARIABLE_RESPONSE_HEADERS_NAMES(*driver.loc.back()); }
|
||||
{VARIABLE_RESPONSE_PROTOCOL} { return p::make_VARIABLE_RESPONSE_PROTOCOL(*driver.loc.back()); }
|
||||
{VARIABLE_RESPONSE_STATUS} { return p::make_VARIABLE_RESPONSE_STATUS(*driver.loc.back()); }
|
||||
{VARIABLE_RX_ERROR} { return p::make_VARIABLE_RX_ERROR(*driver.loc.back()); }
|
||||
{VARIABLE_RX_ERROR_RULE_ID} { return p::make_VARIABLE_RX_ERROR_RULE_ID(*driver.loc.back()); }
|
||||
{VARIABLE_SERVER_ADDR} { return p::make_VARIABLE_SERVER_ADDR(*driver.loc.back()); }
|
||||
{VARIABLE_SERVER_NAME} { return p::make_VARIABLE_SERVER_NAME(*driver.loc.back()); }
|
||||
{VARIABLE_SERVER_PORT} { return p::make_VARIABLE_SERVER_PORT(*driver.loc.back()); }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// A Bison parser, made by GNU Bison 3.7.6.
|
||||
// A Bison parser, made by GNU Bison 3.8.2.
|
||||
|
||||
// Starting with Bison 3.2, this file is useless: the structure it
|
||||
// used to define is now defined with the parser itself.
|
||||
|
||||
Reference in New Issue
Block a user