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

Rule override for adding tags #313

Merged
merged 9 commits into from
Jul 11, 2024
Merged

Rule override for adding tags #313

merged 9 commits into from
Jul 11, 2024

Conversation

Anilm3
Copy link
Collaborator

@Anilm3 Anilm3 commented Jun 18, 2024

This PR introduces support for adding tags to a rule through rule overrides. The schema of rules_override has been updated to support a new tags field, which is a map containing the new tags which must be added to a given set of rules. The set of tags to add must not overlap with the set of default tags already available on the rule; any overlapping tag will be ignored. For example:

"rules_override": [
   {
      "rules_target": [
        {
          "tags": {
            "confidence": "1"
          }
        }
      ],
      "tags": {
          "policy": "custom-policy-1"
      }
   }
]

Tags will only be used for reporting purposes and won't impact other overrides or exclusion filters targeting a tag set.

Related Jira: APPSEC-11810

@Anilm3 Anilm3 requested a review from a team as a code owner June 18, 2024 13:07
@pr-commenter
Copy link

pr-commenter bot commented Jun 18, 2024

Benchmarks

Benchmark execution time: 2024-07-11 14:20:40

Comparing candidate commit b9c7f24 in PR branch anilm3/rule-override-tags with baseline commit 7e6e5b4 in branch master.

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

scenario:bool_equals_matcher.random

  • 🟩 execution_time [-42.991µs; -39.935µs] or [-3.561%; -3.308%]

scenario:exact_match_matcher.random

  • 🟩 execution_time [-63.571µs; -62.051µs] or [-3.431%; -3.348%]

scenario:float_equals_matcher.random

  • 🟩 execution_time [-50.304µs; -47.921µs] or [-4.149%; -3.952%]

scenario:lowercase_transformer.random

  • 🟩 execution_time [-251.518µs; -248.952µs] or [-12.683%; -12.553%]

scenario:phrase_match_matcher.enforce_word_boundary.random

  • 🟥 execution_time [+2.955ms; +2.958ms] or [+41.167%; +41.208%]

scenario:phrase_match_matcher.random

  • 🟩 execution_time [-302.993µs; -297.601µs] or [-3.888%; -3.819%]

scenario:remove_nulls_transformer.random

  • 🟩 execution_time [-2.076ms; -2.067ms] or [-14.443%; -14.376%]

scenario:signed_equals_matcher.random

  • 🟩 execution_time [-46.156µs; -44.784µs] or [-3.826%; -3.712%]

scenario:unsigned_equals_matcher.random

  • 🟩 execution_time [-42.392µs; -38.861µs] or [-3.517%; -3.224%]

@Anilm3 Anilm3 changed the title Rule override for adding or updating tags Rule override for adding tags Jun 21, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.70%. Comparing base (7e6e5b4) to head (b9c7f24).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #313      +/-   ##
==========================================
+ Coverage   83.61%   83.70%   +0.09%     
==========================================
  Files         137      137              
  Lines        6054     6065      +11     
  Branches     2859     2869      +10     
==========================================
+ Hits         5062     5077      +15     
+ Misses        369      367       -2     
+ Partials      623      621       -2     
Flag Coverage Δ
waf_test 83.70% <100.00%> (+0.09%) ⬆️

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.

src/rule.hpp Outdated Show resolved Hide resolved
@Anilm3 Anilm3 merged commit 4aa0a7a into master Jul 11, 2024
44 checks passed
@Anilm3 Anilm3 deleted the anilm3/rule-override-tags branch July 11, 2024 14:59
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