Skip to content

Commit

Permalink
Respond to code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Jan 20, 2023
1 parent c685d46 commit 826c3cc
Show file tree
Hide file tree
Showing 12 changed files with 2,436 additions and 2,456 deletions.
4 changes: 2 additions & 2 deletions headers/modsecurity/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class TransactionAnchoredVariables {
m_variableInboundDataError(t, "INBOUND_DATA_ERROR"),
m_variableMatchedVar(t, "MATCHED_VAR"),
m_variableMatchedVarName(t, "MATCHED_VAR_NAME"),
m_variableMscPcreErrored(t, "MSC_PCRE_ERRORED"),
m_variableMscPcreError(t, "MSC_PCRE_ERROR"),
m_variableMscPcreLimitsExceeded(t, "MSC_PCRE_LIMITS_EXCEEDED"),
m_variableMultipartBoundaryQuoted(t, "MULTIPART_BOUNDARY_QUOTED"),
m_variableMultipartBoundaryWhiteSpace(t,
Expand Down Expand Up @@ -221,7 +221,7 @@ class TransactionAnchoredVariables {
AnchoredVariable m_variableInboundDataError;
AnchoredVariable m_variableMatchedVar;
AnchoredVariable m_variableMatchedVarName;
AnchoredVariable m_variableMscPcreErrored;
AnchoredVariable m_variableMscPcreError;
AnchoredVariable m_variableMscPcreLimitsExceeded;
AnchoredVariable m_variableMultipartBoundaryQuoted;
AnchoredVariable m_variableMultipartBoundaryWhiteSpace;
Expand Down
2 changes: 1 addition & 1 deletion src/operators/rx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool Rx::evaluate(Transaction *transaction, RuleWithActions *rule,

// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
if (regex_result != Utils::RegexResult::Ok) {
transaction->m_variableMscPcreErrored.set("1", transaction->m_variableOffset);
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);

std::string regex_error_str = "OTHER";
if (regex_result == Utils::RegexResult::ErrorMatchLimit) {
Expand Down
2 changes: 1 addition & 1 deletion src/operators/rx_global.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool RxGlobal::evaluate(Transaction *transaction, RuleWithActions *rule,

// FIXME: DRY regex error reporting. This logic is currently duplicated in other operators.
if (regex_result != Utils::RegexResult::Ok) {
transaction->m_variableMscPcreErrored.set("1", transaction->m_variableOffset);
transaction->m_variableMscPcreError.set("1", transaction->m_variableOffset);

std::string regex_error_str = "OTHER";
if (regex_result == Utils::RegexResult::ErrorMatchLimit) {
Expand Down
6 changes: 3 additions & 3 deletions src/parser/seclang-parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4273,10 +4273,10 @@ namespace yy {
#line 4274 "seclang-parser.cc"
break;

case 275: // var: "MSC_PCRE_ERRORED"
case 275: // var: "MSC_PCRE_ERROR"
#line 2327 "seclang-parser.yy"
{
VARIABLE_CONTAINER(yylhs.value.as < std::unique_ptr<Variable> > (), new variables::MscPcreErrored());
VARIABLE_CONTAINER(yylhs.value.as < std::unique_ptr<Variable> > (), new variables::MscPcreError());
}
#line 4282 "seclang-parser.cc"
break;
Expand Down Expand Up @@ -7054,7 +7054,7 @@ namespace yy {
"VARIABLE_RULE", "\"Variable ARGS_NAMES\"", "VARIABLE_ARGS_POST_NAMES",
"\"AUTH_TYPE\"", "\"FILES_COMBINED_SIZE\"", "\"FILES_TMPNAMES\"",
"\"FULL_REQUEST\"", "\"FULL_REQUEST_LENGTH\"", "\"INBOUND_DATA_ERROR\"",
"\"MATCHED_VAR\"", "\"MATCHED_VAR_NAME\"", "\"MSC_PCRE_ERRORED\"",
"\"MATCHED_VAR\"", "\"MATCHED_VAR_NAME\"", "\"MSC_PCRE_ERROR\"",
"\"MSC_PCRE_LIMITS_EXCEEDED\"", "VARIABLE_MULTIPART_BOUNDARY_QUOTED",
"VARIABLE_MULTIPART_BOUNDARY_WHITESPACE", "\"MULTIPART_CRLF_LF_LINES\"",
"\"MULTIPART_DATA_AFTER\"", "VARIABLE_MULTIPART_DATA_BEFORE",
Expand Down
14 changes: 7 additions & 7 deletions src/parser/seclang-parser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class Driver;
#include "src/variables/matched_vars.h"
#include "src/variables/matched_vars_names.h"
#include "src/variables/modsec_build.h"
#include "src/variables/msc_pcre_errored.h"
#include "src/variables/msc_pcre_error.h"
#include "src/variables/msc_pcre_limits_exceeded.h"
#include "src/variables/multipart_boundary_quoted.h"
#include "src/variables/multipart_boundary_whitespace.h"
Expand Down Expand Up @@ -1024,7 +1024,7 @@ namespace yy {
TOK_VARIABLE_INBOUND_DATA_ERROR = 292, // "INBOUND_DATA_ERROR"
TOK_VARIABLE_MATCHED_VAR = 293, // "MATCHED_VAR"
TOK_VARIABLE_MATCHED_VAR_NAME = 294, // "MATCHED_VAR_NAME"
TOK_VARIABLE_MSC_PCRE_ERRORED = 295, // "MSC_PCRE_ERRORED"
TOK_VARIABLE_MSC_PCRE_ERROR = 295, // "MSC_PCRE_ERROR"
TOK_VARIABLE_MSC_PCRE_LIMITS_EXCEEDED = 296, // "MSC_PCRE_LIMITS_EXCEEDED"
TOK_VARIABLE_MULTIPART_BOUNDARY_QUOTED = 297, // VARIABLE_MULTIPART_BOUNDARY_QUOTED
TOK_VARIABLE_MULTIPART_BOUNDARY_WHITESPACE = 298, // VARIABLE_MULTIPART_BOUNDARY_WHITESPACE
Expand Down Expand Up @@ -1389,7 +1389,7 @@ namespace yy {
S_VARIABLE_INBOUND_DATA_ERROR = 37, // "INBOUND_DATA_ERROR"
S_VARIABLE_MATCHED_VAR = 38, // "MATCHED_VAR"
S_VARIABLE_MATCHED_VAR_NAME = 39, // "MATCHED_VAR_NAME"
S_VARIABLE_MSC_PCRE_ERRORED = 40, // "MSC_PCRE_ERRORED"
S_VARIABLE_MSC_PCRE_ERROR = 40, // "MSC_PCRE_ERROR"
S_VARIABLE_MSC_PCRE_LIMITS_EXCEEDED = 41, // "MSC_PCRE_LIMITS_EXCEEDED"
S_VARIABLE_MULTIPART_BOUNDARY_QUOTED = 42, // VARIABLE_MULTIPART_BOUNDARY_QUOTED
S_VARIABLE_MULTIPART_BOUNDARY_WHITESPACE = 43, // VARIABLE_MULTIPART_BOUNDARY_WHITESPACE
Expand Down Expand Up @@ -3117,16 +3117,16 @@ switch (yykind)
#if 201103L <= YY_CPLUSPLUS
static
symbol_type
make_VARIABLE_MSC_PCRE_ERRORED (location_type l)
make_VARIABLE_MSC_PCRE_ERROR (location_type l)
{
return symbol_type (token::TOK_VARIABLE_MSC_PCRE_ERRORED, std::move (l));
return symbol_type (token::TOK_VARIABLE_MSC_PCRE_ERROR, std::move (l));
}
#else
static
symbol_type
make_VARIABLE_MSC_PCRE_ERRORED (const location_type& l)
make_VARIABLE_MSC_PCRE_ERROR (const location_type& l)
{
return symbol_type (token::TOK_VARIABLE_MSC_PCRE_ERRORED, l);
return symbol_type (token::TOK_VARIABLE_MSC_PCRE_ERROR, l);
}
#endif
#if 201103L <= YY_CPLUSPLUS
Expand Down
8 changes: 4 additions & 4 deletions src/parser/seclang-parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Driver;
#include "src/variables/matched_vars.h"
#include "src/variables/matched_vars_names.h"
#include "src/variables/modsec_build.h"
#include "src/variables/msc_pcre_errored.h"
#include "src/variables/msc_pcre_error.h"
#include "src/variables/msc_pcre_limits_exceeded.h"
#include "src/variables/multipart_boundary_quoted.h"
#include "src/variables/multipart_boundary_whitespace.h"
Expand Down Expand Up @@ -369,7 +369,7 @@ using namespace modsecurity::operators;
VARIABLE_INBOUND_DATA_ERROR "INBOUND_DATA_ERROR"
VARIABLE_MATCHED_VAR "MATCHED_VAR"
VARIABLE_MATCHED_VAR_NAME "MATCHED_VAR_NAME"
VARIABLE_MSC_PCRE_ERRORED "MSC_PCRE_ERRORED"
VARIABLE_MSC_PCRE_ERROR "MSC_PCRE_ERROR"
VARIABLE_MSC_PCRE_LIMITS_EXCEEDED "MSC_PCRE_LIMITS_EXCEEDED"
VARIABLE_MULTIPART_BOUNDARY_QUOTED
VARIABLE_MULTIPART_BOUNDARY_WHITESPACE
Expand Down Expand Up @@ -2323,9 +2323,9 @@ var:
{
VARIABLE_CONTAINER($$, new variables::MatchedVarName());
}
| VARIABLE_MSC_PCRE_ERRORED
| VARIABLE_MSC_PCRE_ERROR
{
VARIABLE_CONTAINER($$, new variables::MscPcreErrored());
VARIABLE_CONTAINER($$, new variables::MscPcreError());
}
| VARIABLE_MSC_PCRE_LIMITS_EXCEEDED
{
Expand Down

0 comments on commit 826c3cc

Please sign in to comment.