Skip to content

Conversation

@Talgarr
Copy link
Collaborator

@Talgarr Talgarr commented Apr 18, 2025

Feat: Add --skip CLI option and optimize skipped rule processing

This PR introduces two key improvements:

  1. New --skip Command-Line Option:

    • Allows users to specify a list of rule IDs (e.g., --skip rule1,rule2) to be skipped during execution.
    • These rules are added to any rules already skipped via the configuration file.
    • This provides a convenient way to disable entire rules directly from the command line, overriding any partial skips defined in the configuration for the same rule ID (i.e., if partially skipped in config but fully skipped via CLI, the rule is fully skipped).
  2. Performance Optimization for Skipped Rules:

    • Previously, all rules were processed/compiled, and their results were filtered afterwards according to the skip configuration.
    • This change optimizes the process: Rules marked for complete skipping (either via config or the new --skip CLI option) are now identified before processing and are not compiled or executed.
    • This avoids unnecessary computation for fully skipped rules, improving performance. Partial rule filtering (e.g., based on specific findings like osv_id) still requires the rule to be processed first.

Do not compile rules that are going to be filtered by the config

Move HasOnlyRule to valid place

Add cli
@Talgarr Talgarr force-pushed the optimize_skip_rule branch from 899d5a2 to 8f606b7 Compare April 18, 2025 18:36
@Talgarr Talgarr marked this pull request as ready for review April 18, 2025 18:47
@Talgarr Talgarr requested a review from a team as a code owner April 18, 2025 18:47
Signed-off-by: Sébastien Graveline <[email protected]>
Co-authored-by: Alexis-Maurer Fortin <[email protected]>
Signed-off-by: Sébastien Graveline <[email protected]>
@Talgarr Talgarr requested a review from SUSTAPLE117 April 18, 2025 19:09
@fproulx-boostsecurity fproulx-boostsecurity merged commit 3185069 into boostsecurityio:main Apr 18, 2025
6 checks passed
Talgarr added a commit to Talgarr/poutine that referenced this pull request Apr 24, 2025
Refactoring

Do not compile rules that are going to be filtered by the config

Move HasOnlyRule to valid place

Add cli

* Update cli message

Signed-off-by: Sébastien Graveline <[email protected]>

* Update opa/opa.go

Co-authored-by: Alexis-Maurer Fortin <[email protected]>
Signed-off-by: Sébastien Graveline <[email protected]>

---------

Signed-off-by: Sébastien Graveline <[email protected]>
Co-authored-by: Alexis-Maurer Fortin <[email protected]>
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.

3 participants