mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Adds support for the tag action
This commit is contained in:
@@ -19,6 +19,7 @@ class Driver;
|
||||
#include "actions/action.h"
|
||||
#include "actions/set_var.h"
|
||||
#include "actions/msg.h"
|
||||
#include "actions/tag.h"
|
||||
#include "actions/transformations/transformation.h"
|
||||
#include "operators/operator.h"
|
||||
#include "rule.h"
|
||||
@@ -43,6 +44,7 @@ class Driver;
|
||||
|
||||
using ModSecurity::actions::Action;
|
||||
using ModSecurity::actions::SetVar;
|
||||
using ModSecurity::actions::Tag;
|
||||
using ModSecurity::actions::Msg;
|
||||
using ModSecurity::actions::transformations::Transformation;
|
||||
using ModSecurity::operators::Operator;
|
||||
@@ -189,6 +191,7 @@ using ModSecurity::Variables::Variable;
|
||||
%token <std::string> ACTION_SEVERITY
|
||||
%token <std::string> ACTION_SETVAR
|
||||
%token <std::string> ACTION_MSG
|
||||
%token <std::string> ACTION_TAG
|
||||
%token <std::string> TRANSFORMATION
|
||||
|
||||
%token <double> CONFIG_VALUE_NUMBER
|
||||
@@ -668,6 +671,28 @@ actions:
|
||||
actions->push_back(msg);
|
||||
$$ = actions;
|
||||
}
|
||||
| actions COMMA ACTION_TAG
|
||||
{
|
||||
std::vector<Action *> *a = $1;
|
||||
Tag *tag = new Tag($3);
|
||||
a->push_back(tag);
|
||||
$$ = $1;
|
||||
}
|
||||
| SPACE ACTION_TAG
|
||||
{
|
||||
std::vector<Action *> *actions = new std::vector<Action *>;
|
||||
Tag *tag = new Tag($2);
|
||||
actions->push_back(tag);
|
||||
$$ = actions;
|
||||
|
||||
}
|
||||
| ACTION_TAG
|
||||
{
|
||||
std::vector<Action *> *actions = new std::vector<Action *>;
|
||||
Tag *tag = new Tag($1);
|
||||
actions->push_back(tag);
|
||||
$$ = actions;
|
||||
}
|
||||
|
||||
%%
|
||||
void
|
||||
|
@@ -23,10 +23,11 @@ using ModSecurity::split;
|
||||
%}
|
||||
%option noyywrap nounput batch debug noinput
|
||||
|
||||
ACTION (?i:accuracy|allow|append|auditlog|block|capture|chain|ctl|deny|deprecatevar|drop|exec|expirevar|id:[0-9]+|id:'[0-9]+'|initcol|log|logdata|maturity|multiMatch|noauditlog|nolog|pass|pause|phase:[0-9]+|prepend|proxy|redirect:[A-Z0-9_\|\&\:\/\/\.]+|rev|sanitiseArg|sanitiseMatched|sanitiseMatchedBytes|sanitiseRequestHeader|sanitiseResponseHeader|setuid|setrsc|setsid|setenv|skip|skipAfter|status:[0-9]+|tag|ver|xmlns)
|
||||
ACTION (?i:accuracy|allow|append|auditlog|block|capture|chain|ctl|deny|deprecatevar|drop|exec|expirevar|id:[0-9]+|id:'[0-9]+'|initcol|log|logdata|maturity|multiMatch|noauditlog|nolog|pass|pause|phase:[0-9]+|prepend|proxy|redirect:[A-Z0-9_\|\&\:\/\/\.]+|rev|sanitiseArg|sanitiseMatched|sanitiseMatchedBytes|sanitiseRequestHeader|sanitiseResponseHeader|setuid|setrsc|setsid|setenv|skip|skipAfter|status:[0-9]+|ver|xmlns)
|
||||
ACTION_SEVERITY (?i:severity:[0-9]+|severity:'[0-9]+'|severity:(EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG)|severity:'(EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG)')
|
||||
ACTION_SETVAR (?i:setvar)
|
||||
ACTION_MSG (?i:msg)
|
||||
ACTION_TAG (?i:tag)
|
||||
DIRECTIVE SecRule
|
||||
|
||||
CONFIG_DIRECTIVE SecRequestBodyNoFilesLimit|SecRequestBodyInMemoryLimit|SecPcreMatchLimitRecursion|SecPcreMatchLimit|SecResponseBodyMimeType|SecTmpDir|SecDataDir|SecArgumentSeparator|SecCookieFormat|SecStatusEngine
|
||||
@@ -200,6 +201,7 @@ FREE_TEXT_NEW_LINE [^\"|\n]+
|
||||
return yy::seclang_parser::make_ACTION_SETVAR(strchr(yytext, ':') + 1, *driver.loc.back());
|
||||
}
|
||||
{ACTION_MSG}:'{FREE_TEXT}' { return yy::seclang_parser::make_ACTION_MSG(strchr(yytext, ':') + 1, *driver.loc.back()); }
|
||||
{ACTION_TAG}:'{FREE_TEXT}' { return yy::seclang_parser::make_ACTION_TAG(strchr(yytext, ':') + 1, *driver.loc.back()); }
|
||||
|
||||
["] { return yy::seclang_parser::make_QUOTATION_MARK(*driver.loc.back()); }
|
||||
[,] { return yy::seclang_parser::make_COMMA(*driver.loc.back()); }
|
||||
|
Reference in New Issue
Block a user