-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRS strconv.Atoi: parsing tx.blocking_outbound_anomaly_score: invalid syntax #888
Comments
Hi @davidmytton, thanks for reporting it. It seems like you are facing some problems related to variable expansion. The value is indeed the string name I'm trying to reproduce it, but I'm not succeeding. This is the branch where I'm trying to follow your steps: https://github.com/M4tteoP/coraza/tree/atoi_repro.
Specifically looking at the logs of rule
I tried with Coraza Thanks for your help |
Thanks for looking into this @M4tteoP I pushed 76aee6e which reproduces the issue from your branch with a test rule
Interested to hear your thoughts on whether this is an issue in the zap adapter or whether there's something else going on. Seems like CRS has something to do with it given my zap adapter works fine without CRS. |
Thanks for your repro example! As far as I can see, the root cause of the issue is a misconfiguration originated by the rules order, specifically by the Rules are executed following the inclusion order according to phases, so, within each phase, the order of rules matters. The inclusion order of your rules files is the following:
Expanding it a little:
The
So, the following happens:
To recap: custom rules should be added after the CRS rules, or integrated into the CRS order logic. To grasp a bit more about rules positioning, a nice reference is https://github.com/coreruleset/template-plugin#order-of-rules-with-plugins-and-existing-crs-rules. It is about extending the CRS with custom plugins (aka extra rules), and current limitations of the CRS plugin architecture. Digging into this I opened #892. I think that we should at least be a bit more verbose when this error happens, clearly stating that a variable has not been found. Among other small fixes and improvements, the PR proposes to add a warning log in that case.
Just for the sake of completeness, I added 980737f in which I'm able to reproduce the Atoi error even without the zap adapter. The only difference I saw is that with a smaller logger, the error is limited to a single error line, not including the full trace printed with the Zap adapter. |
Thanks for the detailed explanation, that makes sense. Moving the custom rule after CRS resolves this! The extra debug info in #892 will also be helpful. |
Description
With Core Rule Set
ver.4.0.0-rc1
I'm seeing Coraza log an error when parsing theRESPONSE-980-CORRELATION.conf
rule. I have tested this with Corazav3.0.4
and also pinning to a specific commit 2624bf3Steps to reproduce
Send an HTTP request that triggers an interrupt through Coraza with the default config + core ruleset 4.0.0-rc1
Actual result
The text was updated successfully, but these errors were encountered: