corazawaf / coraza

OWASP Coraza WAF is a golang modsecurity compatible web application firewall library
https://www.coraza.io
Apache License 2.0
2.3k stars 228 forks source link

Cannot diable two rules on different URIs #617

Closed undergroundwires closed 1 year ago

undergroundwires commented 1 year ago

I use latest coraza-caddy with Caddy along with core ruleset.

My Caddyfile configuration looks like:

coraza_waf {
    include /waf/extra-rules.conf # Must be imported before other rules for exceptions to work.

    # As recommended by https://github.com/corazawaf/coraza-caddy
    include /waf/coraza.conf-recommended
    include /waf/coreruleset/crs-setup.conf.example
    include /waf/coreruleset/rules/*.conf
    }

In /waf/extra-rules.conf I have some URI-based exceptions which work fine. However, if I disable same rule on two different URI based rules, the whole file is ignored and none of the exceptions work.

So this works fine:

SecRule REQUEST_URI "@beginsWith /test1" \
      "id:1000101,\
      phase:1,\
      pass,\
      nolog,\
       ctl:ruleRemoveById=911100"

But If I add one more rule that will run ruleRemoveById on different URI (e.g. /test2), all other exceptions in the file fails and are ignored. This configuration does not work:

SecRule REQUEST_URI "@beginsWith /test1" \
      "id:1000101,\
      phase:1,\
      pass,\
      nolog,\
       ctl:ruleRemoveById=911100"

SecRule REQUEST_URI "@beginsWith /test2" \
      "id:1000201,\
      phase:1,\
      pass,\
      nolog,\
       ctl:ruleRemoveById=911100"
undergroundwires commented 1 year ago

Thank you for quick action @jcchavezs , happy to see this repo being maintained nicely. This time it was my misconfiguration, no problem from coraza side. Please ignore this issue completely. Thank you all four your efforts for coraza.

jcchavezs commented 1 year ago

Awesome, thanks!

On Thu, 9 Feb 2023, 01:55 undergroundwires, @.***> wrote:

Closed #617 https://github.com/corazawaf/coraza/issues/617 as completed.

— Reply to this email directly, view it on GitHub https://github.com/corazawaf/coraza/issues/617#event-8474416026, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXOYATXNIUG32LLOOC2JLLWWQ6BHANCNFSM6AAAAAAUVXYG2U . You are receiving this because you were mentioned.Message ID: @.***>