mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Adds support to SecWebAppID
This commit is contained in:
@@ -39,7 +39,8 @@ class Resource_DictElement : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveMultiMatches(m_dictElement, "RESOURCE", l);
|
||||
transaction->m_collections.resolveMultiMatches(m_dictElement,
|
||||
"RESOURCE", transaction->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
|
||||
std::string m_dictElement;
|
||||
@@ -54,7 +55,8 @@ class Resource_NoDictElement : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveMultiMatches(m_name, "RESOURCE", l);
|
||||
transaction->m_collections.resolveMultiMatches(m_name, "RESOURCE",
|
||||
transaction->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +72,7 @@ class Resource_DictElementRegexp : public Variable {
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveRegularExpression(m_dictElement,
|
||||
"RESOURCE", l);
|
||||
"RESOURCE", transaction->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
|
||||
Utils::Regex m_r;
|
||||
|
@@ -40,7 +40,7 @@ class Session_DictElement : public Variable {
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveMultiMatches(m_dictElement,
|
||||
"SESSION", l);
|
||||
"SESSION", transaction->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
|
||||
std::string m_dictElement;
|
||||
@@ -55,7 +55,8 @@ class Session_NoDictElement : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveMultiMatches(m_name, "SESSION", l);
|
||||
transaction->m_collections.resolveMultiMatches(m_name, "SESSION",
|
||||
transaction->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -71,7 +72,7 @@ class Session_DictElementRegexp : public Variable {
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveRegularExpression(m_dictElement,
|
||||
"SESSION", l);
|
||||
"SESSION", transaction->m_rules->m_secWebAppId.m_value, l);
|
||||
}
|
||||
|
||||
Utils::Regex m_r;
|
||||
|
@@ -120,50 +120,6 @@ Variable::Variable(std::string name, VariableKind kind)
|
||||
}
|
||||
|
||||
|
||||
std::vector<const collection::Variable *> *
|
||||
Variable::evaluate(Transaction *transaction) {
|
||||
std::vector<const collection::Variable *> *l;
|
||||
l = new std::vector<const collection::Variable *>();
|
||||
evaluate(transaction, NULL, l);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
void Variable::evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
if (m_collectionName.empty() == false) {
|
||||
if (m_kind == CollectionVarible && m_type == MultipleMatches) {
|
||||
transaction->m_collections.resolveMultiMatches(m_name,
|
||||
m_collectionName, l);
|
||||
} else if (m_type == RegularExpression) {
|
||||
transaction->m_collections.resolveRegularExpression(m_name,
|
||||
m_collectionName, l);
|
||||
} else {
|
||||
transaction->m_collections.resolveSingleMatch(m_name,
|
||||
m_collectionName, l);
|
||||
}
|
||||
} else {
|
||||
if (m_kind == CollectionVarible && m_type == MultipleMatches) {
|
||||
transaction->m_collections.resolveMultiMatches(m_name, l);
|
||||
} else if (m_type == RegularExpression) {
|
||||
transaction->m_collections.resolveRegularExpression(m_name, l);
|
||||
} else {
|
||||
transaction->m_collections.resolveSingleMatch(m_name, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Variable::evaluateInternal(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
|
||||
evaluate(transaction, rule, l);
|
||||
}
|
||||
|
||||
|
||||
std::string Variable::to_s(
|
||||
std::vector<Variable *> *variables) {
|
||||
std::string ret;
|
||||
|
@@ -70,19 +70,9 @@ class Variable {
|
||||
Variable(std::string name, VariableKind kind);
|
||||
virtual ~Variable() { }
|
||||
|
||||
|
||||
virtual std::vector<const collection::Variable *>
|
||||
*evaluate(Transaction *transaction);
|
||||
|
||||
|
||||
virtual void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l);
|
||||
|
||||
|
||||
virtual void evaluateInternal(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l);
|
||||
std::vector<const collection::Variable *> *l) = 0;
|
||||
|
||||
static std::string to_s(std::vector<Variable *> *variables);
|
||||
|
||||
|
Reference in New Issue
Block a user