mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 02:10:36 +03:00
Extends the direct access model to other collections
This commit is contained in:
committed by
Felipe Zimmerle
parent
ca24b6bb06
commit
f2d149fc5f
@@ -29,15 +29,55 @@ namespace modsecurity {
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class Tx : public Variable {
|
||||
public:
|
||||
explicit Tx(std::string _name)
|
||||
: Variable(_name) { }
|
||||
|
||||
void evaluateInternal(Transaction *transaction,
|
||||
std::vector<const collection::Variable *> *l) override;
|
||||
class Tx_DictElement : public Variable {
|
||||
public:
|
||||
explicit Tx_DictElement(std::string dictElement)
|
||||
: Variable("TX"),
|
||||
m_dictElement("TX:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveMultiMatches(m_dictElement, "TX", l);
|
||||
}
|
||||
|
||||
std::string m_dictElement;
|
||||
};
|
||||
|
||||
|
||||
class Tx_NoDictElement : public Variable {
|
||||
public:
|
||||
explicit Tx_NoDictElement()
|
||||
: Variable("TX") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveMultiMatches(m_name, "TX", l);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Tx_DictElementRegexp : public Variable {
|
||||
public:
|
||||
Tx_DictElementRegexp(std::string dictElement)
|
||||
: Variable("TX"),
|
||||
m_r(dictElement),
|
||||
m_dictElement("TX:" + dictElement) { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_collections.resolveRegularExpression(m_dictElement,
|
||||
"TX", l);
|
||||
}
|
||||
|
||||
Utils::Regex m_r;
|
||||
std::string m_dictElement;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
|
||||
Reference in New Issue
Block a user