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

Support min_version and max_version on evaluation primitives and RASP operator versioning #343

Merged
merged 12 commits into from
Oct 11, 2024

Conversation

Anilm3
Copy link
Collaborator

@Anilm3 Anilm3 commented Oct 10, 2024

This PR introduces:

  • New min_version and max_version tags on evaluation primitives (rules, exclusion filters, processors and scanners). These tags are used define the range of libddwaf versions [min_version, max_version] for which the rule should be applied. When the evaluation primitive is not compatible with the current version, the ID is included in the relevant diagnostics, within the new skipped section.
  • Support for operator version, specifically for RASP operators, through a suffix such as sqli_detector@v2. The current implementation only allows a single version number, rather than the typical three dot-separated version numbers. Operator version numbers work as follows:
    • When the required version is equal or smaller to the current operator version, the current operator is considered version-compliant.
    • When the required version is higher than the current version, the rule containing said RASP operator is entirely skipped.

@Anilm3 Anilm3 requested a review from a team as a code owner October 10, 2024 14:41
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 74.57627% with 30 lines in your changes missing coverage. Please review.

Project coverage is 84.54%. Comparing base (851a05d) to head (27f9944).

Files with missing lines Patch % Lines
src/semver.hpp 65.95% 0 Missing and 16 partials ⚠️
src/parser/exclusion_parser.cpp 55.55% 2 Missing and 2 partials ⚠️
src/parser/processor_parser.cpp 55.55% 2 Missing and 2 partials ⚠️
src/parser/rule_parser.cpp 83.33% 0 Missing and 2 partials ⚠️
src/ruleset_info.hpp 60.00% 1 Missing and 1 partial ⚠️
src/parser/expression_parser.cpp 94.44% 0 Missing and 1 partial ⚠️
src/parser/scanner_parser.cpp 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #343      +/-   ##
==========================================
- Coverage   84.75%   84.54%   -0.21%     
==========================================
  Files         149      150       +1     
  Lines        7143     7248     +105     
  Branches     3297     3356      +59     
==========================================
+ Hits         6054     6128      +74     
- Misses        410      417       +7     
- Partials      679      703      +24     
Flag Coverage Δ
waf_test 84.54% <74.57%> (-0.21%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pr-commenter
Copy link

pr-commenter bot commented Oct 10, 2024

Benchmarks

Benchmark execution time: 2024-10-11 13:10:55

Comparing candidate commit 27f9944 in PR branch anilm3/rule-and-operator-version with baseline commit 851a05d in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 0 metrics, 0 unstable metrics.

scenario:global-benchmark.random

  • 🟥 execution_time [+20.745ms; +20.803ms] or [+7.510%; +7.531%]

@estringana estringana self-assigned this Oct 11, 2024
src/version.hpp.in Outdated Show resolved Hide resolved
Copy link
Contributor

@cataphract cataphract left a comment

Choose a reason for hiding this comment

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

I find it quite sad that we're adding two overlapping mechanism for version-based selection, but o/wise it's fine

src/parser/exclusion_parser.cpp Show resolved Hide resolved
src/parser/expression_parser.cpp Outdated Show resolved Hide resolved
src/semver.hpp Outdated Show resolved Hide resolved
src/semver.hpp Show resolved Hide resolved
src/semver.hpp Show resolved Hide resolved
src/semver.hpp Show resolved Hide resolved
@Anilm3 Anilm3 merged commit 609eaf1 into master Oct 11, 2024
50 checks passed
@Anilm3 Anilm3 deleted the anilm3/rule-and-operator-version branch October 11, 2024 13:31
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.

4 participants