mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Adds support to the `skip' action
This commit is contained in:
11
src/rules.cc
11
src/rules.cc
@@ -185,9 +185,7 @@ int Rules::evaluate(int phase, Transaction *transaction) {
|
||||
|
||||
for (int i = 0; i < rules.size(); i++) {
|
||||
Rule *rule = rules[i];
|
||||
if (transaction->m_marker.empty()) {
|
||||
rule->evaluate(transaction);
|
||||
} else {
|
||||
if (transaction->m_marker.empty() == false) {
|
||||
debug(9, "Skipped rule id '" + std::to_string(rule->rule_id) \
|
||||
+ "' due to a SecMarker: " + transaction->m_marker);
|
||||
m_secmarker_skipped++;
|
||||
@@ -198,6 +196,13 @@ int Rules::evaluate(int phase, Transaction *transaction) {
|
||||
transaction->m_marker.clear();
|
||||
m_secmarker_skipped = 0;
|
||||
}
|
||||
} else if (transaction->m_skip_next > 0) {
|
||||
transaction->m_skip_next--;
|
||||
debug(9, "Skipped rule id '" + std::to_string(rule->rule_id) \
|
||||
+ "' due to `skip' action. Still " + \
|
||||
std::to_string(transaction->m_skip_next) + " to be skipped.");
|
||||
} else {
|
||||
rule->evaluate(transaction);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user