Repository navigation
feat(engine): run phase 5 (logging) after a disruptive verdict - #10
Merged
Merged
Conversation
ModSecurity treats phase 5 as special: the logging phase runs on every transaction, including one intercepted in an earlier phase, so a blocked transaction is still logged and its correlation rules (CRS 980xxx) run. run_phase previously returned early on any non-Allow verdict, stopping every later phase including logging. - run_phase lets Phase::Logging past the stop-after-block guard. - A disruptive action in phase 5 is ignored, so logging never intercepts and never disturbs an earlier verdict. - Phases 3 and 4 still skip after an earlier block; only phase 5 is exempt. Tests: phase 5 runs and applies its setvar after a phase-2 block with the verdict unchanged; a disruptive phase-5 rule does not change an allowed verdict; a phase-3 block still skips phase 4. Closes #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9.
What
ModSecurity treats phase 5 (logging) as special: it runs on every transaction, including one intercepted in an earlier phase, so a blocked transaction is still logged and its correlation rules (CRS 980xxx) run.
run_phasepreviously returned early on any non-Allowverdict, which stopped every later phase, logging included.Change
run_phaseletsPhase::Loggingpast the stop-after-block guard.phase != Loggingon the intercept arm), so logging never intercepts and never disturbs an earlier verdict.Tests
phase_five_logging_runs_after_a_block: a phase-2 block, then phase 5 runs and applies itssetvar, with the verdict unchanged.a_disruptive_action_in_phase_five_does_not_change_the_verdict.a_phase_three_block_still_skips_phase_four.Downstream
Enables barbacane's WAF audit log to carry CRS correlation output on blocked transactions. A
barbacane-waf0.1.1 release follows so barbacane can bump the dep.