Skip to content
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

registers pmFromDataset, fixes Dataset propagation, adds tests #777

Merged
merged 2 commits into from Apr 19, 2023

Conversation

M4tteoP
Copy link
Member

@M4tteoP M4tteoP commented Apr 17, 2023

This PR proses to:

  • Register pmFromDataset operator. It has been added alongside ipMatchFromDataset, the latter is properly registered, but not the first. I guess we just forgot it, I think that it is still a valuable operator.
  • Fixes options.Datasets propagation: Inside pmFromDataset and ipMatchFromDataset the Datasets slice was always ending to be empty resulting in an error not being able to find the dataset.
  • Adds operators_with_dataset tests for both pmFromDataset and ipMatchFromDataset.

@M4tteoP M4tteoP requested a review from a team as a code owner April 17, 2023 11:29
@@ -105,7 +105,7 @@ Go build tags can tweak certain functionality at compile-time. These are for adv
have compatibility guarantees across minor versions - use with care.

- coraza.disabled_operators.* - excludes the specified operator from compilation. Particularly useful if overriding
the operator with `operators.Register` to reduce binary size / startup overhead.
the operator with `plugins.RegisterOperator` to reduce binary size / startup overhead.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #734 operators have been moved to an internal package, from an user standpoint it is better to point out directly plugins.RegisterOperator, isn't it?

@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

Patch coverage: 88.00% and no project coverage change.

Comparison is base (6f11f53) 81.85% compared to head (9148414) 81.86%.

Additional details and impacted files
@@           Coverage Diff           @@
##           v3/dev     #777   +/-   ##
=======================================
  Coverage   81.85%   81.86%           
=======================================
  Files         153      153           
  Lines        8188     8192    +4     
=======================================
+ Hits         6702     6706    +4     
  Misses       1267     1267           
  Partials      219      219           
Flag Coverage Δ
default 78.10% <88.00%> (+0.01%) ⬆️
examples 26.03% <80.00%> (+0.03%) ⬆️
ftw 49.12% <84.00%> (+0.02%) ⬆️
ftw-multiphase 49.23% <84.00%> (+0.02%) ⬆️
tinygo 77.24% <87.50%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
internal/seclang/rule_parser.go 88.71% <85.71%> (+0.02%) ⬆️
http/interceptor.go 51.28% <100.00%> (ø)
internal/operators/pm_from_dataset.go 100.00% <100.00%> (ø)
internal/seclang/directives.go 76.84% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@anuraaga
Copy link
Contributor

We added this for proxy-wasm but ended up not needing it. Do we know of any other users of the feature? We might consider actually removing it if we don't have a usecase anymore.

@M4tteoP
Copy link
Member Author

M4tteoP commented Apr 19, 2023

We added this for proxy-wasm but ended up not needing it

The usecase I was thinking about is proxy-wasm, and the possibility to add new custom rules to a Wasm that has already been built (and maybe distributed). I think it is still a scenario where we have no alternatives to *FromDataset operators that permits us to load .data information not at build time 🤔

@M4tteoP M4tteoP merged commit 42d4ae8 into corazawaf:v3/dev Apr 19, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants