-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
fixes misspelled build tag coraza.rule.multiphase_evaluation #1338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting it and opening the PR!
@@ -282,7 +282,7 @@ func TagsMatrix() error { | |||
"coraza.rule.case_sensitive_args_keys", | |||
"coraza.rule.no_regex_multiline", | |||
"memoize_builders", | |||
"coraza.rule.multiphase_valuation", | |||
"coraza.rule.multiphase_evaluation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, this changes the permutations of build tags generated for the CI, and a permutation is failing now with the correct tag 🫤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, does this mean it only succeeded before because it was incorrectly set?
this would make sense because the rules in the failing test here use ARGS
https://github.com/corazawaf/coraza/blob/main/testing/engine/variables.go#L174
if it was not correctly set before this matched...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, does this mean it only succeeded before because it was incorrectly set?
Yes, I think so. This is a quite recently added test, and we did not catch that it is not flexible enough to work with multiphase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just took a quick look, but I think that:
- the test is expecting exactly the following line
Message from rule 12: ARGS:key2[name], macro expansion: PaYlOaD
in the logs - multiphase is splitting ARGS into ARGS_GET and ARGS_POST, therefore, I suspect the log line is going to be
Message from rule 12: ARGS_POST:key2[name], macro expansion: PaYlOaD
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
somehow I can't test it locally on my side.. when i run go run mage.go coverage
i get the following error:
Running tests with coverage
Tags: memoize_builders,coraza.rule.multiphase_evaluation,no_fs_access
go: downloading github.com/corazawaf/coraza-coreruleset v0.0.0-20240226094324-415b1017abdc
# github.com/corazawaf/coraza/v3/internal/seclang
github.com/corazawaf/coraza-coreruleset@v0.0.0-20240226094324-415b1017abdc: reading https://proxy.golang.org/github.com/corazawaf/coraza-coreruleset/@v/v0.0.0-20240226094324-415b1017abdc.zip: 403 Forbidden
FAIL github.com/corazawaf/coraza/v3/internal/seclang [setup failed]
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1338 +/- ##
==========================================
+ Coverage 81.99% 84.09% +2.10%
==========================================
Files 170 170
Lines 9803 9803
==========================================
+ Hits 8038 8244 +206
+ Misses 1518 1317 -201
+ Partials 247 242 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SecRule TX:macro_exp_var "@contains newValue" | ||
SecRule ARGS:key2[name] "@contains PaYlOaD" "id:12,phase:2,pass,log,logdata:'Message from rule 12: %{MATCHED_VAR_NAME}, macro expansion: %{ARGS.key2[name]}'" | ||
SecRule ARGS_POST:key2[name] "@contains PaYlOaD" "id:12,phase:2,pass,log,logdata:'Message from rule 12: %{MATCHED_VAR_NAME}, macro expansion: %{ARGS_POST.key2[name]}'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! We should have dedicated tests (to be checked) with multiphase checking the ARGS -> ARGS_POST conversion, so this test should be good like this.
No description provided.