mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Fix SecRuleUpdateTargetByTag with regular expressions
This commit is contained in:
@@ -106,7 +106,7 @@ namespace variables {
|
||||
|
||||
class KeyExclusion {
|
||||
public:
|
||||
virtual bool match(std::string &a) = 0;
|
||||
virtual bool match(const std::string &a) = 0;
|
||||
virtual ~KeyExclusion() { }
|
||||
};
|
||||
|
||||
@@ -121,7 +121,7 @@ class KeyExclusionRegex : public KeyExclusion {
|
||||
|
||||
~KeyExclusionRegex() override { }
|
||||
|
||||
bool match(std::string &a) override {
|
||||
bool match(const std::string &a) override {
|
||||
return m_re.searchAll(a).size() > 0;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class KeyExclusionString : public KeyExclusion {
|
||||
|
||||
~KeyExclusionString() override { }
|
||||
|
||||
bool match(std::string &a) override {
|
||||
bool match(const std::string &a) override {
|
||||
return a.size() == m_key.size() && std::equal(a.begin(), a.end(),
|
||||
m_key.begin(),
|
||||
[](char aa, char bb) {
|
||||
@@ -608,6 +608,10 @@ class Variables : public std::vector<Variable *> {
|
||||
bool contains(const std::string &v) {
|
||||
return std::find_if(begin(), end(),
|
||||
[v](Variable *m) -> bool {
|
||||
VariableRegex *r = dynamic_cast<VariableRegex *>(m);
|
||||
if (r) {
|
||||
return r->m_r.searchAll(v).size() > 0;
|
||||
}
|
||||
return v == *m->m_fullName.get();
|
||||
}) != end();
|
||||
};
|
||||
|
Reference in New Issue
Block a user