mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Adds support to WEBAPPID variable
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -223,6 +223,7 @@ class Driver;
|
||||
#include "src/variables/server_name.h"
|
||||
#include "src/variables/server_port.h"
|
||||
#include "src/variables/session_id.h"
|
||||
#include "src/variables/web_app_id.h"
|
||||
#include "src/variables/time_day.h"
|
||||
#include "src/variables/time_epoch.h"
|
||||
#include "src/variables/time.h"
|
||||
@@ -432,6 +433,7 @@ using modsecurity::operators::Operator;
|
||||
VARIABLE_UNIQUE_ID "UNIQUE_ID"
|
||||
VARIABLE_URL_ENCODED_ERROR "URLENCODED_ERROR"
|
||||
VARIABLE_USER_ID "USERID"
|
||||
VARIABLE_WEB_APP_ID "WEBAPPID"
|
||||
VARIABLE_STATUS "VARIABLE_STATUS"
|
||||
VARIABLE_IP "VARIABLE_IP"
|
||||
VARIABLE_GLOBAL "VARIABLE_GLOBAL"
|
||||
@@ -2138,6 +2140,10 @@ var:
|
||||
{
|
||||
VARIABLE_CONTAINER($$, new Variables::Status());
|
||||
}
|
||||
| VARIABLE_WEB_APP_ID
|
||||
{
|
||||
VARIABLE_CONTAINER($$, new Variables::WebAppId());
|
||||
}
|
||||
| RUN_TIME_VAR_DUR
|
||||
{
|
||||
std::string name($1);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -195,6 +195,7 @@ VARIABLE_IP (?i:(IP))
|
||||
VARIABLE_USER (?i:(USER))
|
||||
VARIABLE_STATUS (?i:(STATUS[^:]))
|
||||
VARIABLE_TX (?i:TX)
|
||||
VARIABLE_WEB_APP_ID (?i:WEBAPPID)
|
||||
RUN_TIME_VAR_BLD (?i:MODSEC_BUILD)
|
||||
RUN_TIME_VAR_DUR (?i:DURATION)
|
||||
RUN_TIME_VAR_ENV (?i:ENV)
|
||||
@@ -771,6 +772,7 @@ p::make_CONFIG_SEC_RULE_REMOVE_BY_TAG(parserSanitizer(strchr(yytext, ' ') + 1),
|
||||
{VARIABLE_UNIQUE_ID} { return p::make_VARIABLE_UNIQUE_ID(*driver.loc.back()); }
|
||||
{VARIABLE_URL_ENCODED_ERROR} { return p::make_VARIABLE_URL_ENCODED_ERROR(*driver.loc.back()); }
|
||||
{VARIABLE_USER_ID} { return p::make_VARIABLE_USER_ID(*driver.loc.back()); }
|
||||
{VARIABLE_WEB_APP_ID} { return p::make_VARIABLE_WEB_APP_ID(*driver.loc.back()); }
|
||||
{VARIABLE_ARGS} { return p::make_VARIABLE_ARGS(*driver.loc.back()); }
|
||||
{VARIABLE_ARGS}[:] { BEGIN(EXPECTING_VAR_PARAMETER); return p::make_VARIABLE_ARGS(*driver.loc.back()); }
|
||||
{VARIABLE_ARGS_GET} { return p::make_VARIABLE_ARGS_GET(*driver.loc.back()); }
|
||||
|
50
src/variables/web_app_id.h
Normal file
50
src/variables/web_app_id.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#ifndef SRC_VARIABLES_WEB_APP_ID_H_
|
||||
#define SRC_VARIABLES_WEB_APP_ID_H_
|
||||
|
||||
#include "src/variables/variable.h"
|
||||
#include "modsecurity/rule.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class WebAppId : public Variable {
|
||||
public:
|
||||
explicit WebAppId()
|
||||
: Variable("WEBAPPID") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
const std::string name("WEBAPPID");
|
||||
const std::string rname = transaction->m_rules->m_secWebAppId.m_value;
|
||||
l->push_back(new collection::Variable(&m_name, &rname));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_VARIABLES_WEB_APP_ID_H_
|
Reference in New Issue
Block a user