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

Remove caches for the KATalogus in the scheduler #4108

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jpbruinsslot
Copy link
Contributor

@jpbruinsslot jpbruinsslot commented Feb 19, 2025

Changes

  • Add a filter parameter in the KATalogus Plugins API to allow filtering on what the plugin consumes and produces to support it
  • Removal of katalogus caches in the scheduler

Issue link

Reference #3357

QA notes

Interaction between the scheduler and katalogus has been optimized. Scanning of large volumes of items should function better, and without any issues monitored in either the katalogus or the scheduler.


Code Checklist

  • All the commits in this PR are properly PGP-signed and verified.
  • This PR only contains functionality relevant to the issue.
  • I have written unit tests for the changes or fixes I made.
  • I have checked the documentation and made changes where necessary.
  • I have performed a self-review of my code and refactored it to the best of my abilities.
  • Tickets have been created for newly discovered issues.
  • For any non-trivial functionality, I have added integration and/or end-to-end tests.
  • I have informed others of any required .env changes files if required and changed the .env-dist accordingly.
  • I have included comments in the code to elaborate on what is not self-evident from the code itself, including references to issues and discussions online, or implicit behavior of an interface.

Checklist for code reviewers:

Copy-paste the checklist from the docs/source/templates folder into your comment.


Checklist for QA:

Copy-paste the checklist from the docs/source/templates folder into your comment.

Add filter parameter in the KATalogus Plugins API to allow filtering on what the plugin consumes and produces to support it
@jpbruinsslot jpbruinsslot linked an issue Feb 19, 2025 that may be closed by this pull request
…uler

* main:
  add 1.18 release notes (#4083)
  Combined schedulers (#3839)
  remove inline styling / svg graph as not compatible with out CSP (#4075)
  Hotfix for empty report in history table (#4087)
  optimize various bits around scan profiles (#4050)
plugins = [plugin for plugin in plugins if filter_params.consumes.issubset(set(plugin.consumes))]

if filter_params.produces is not None:
plugins = [plugin for plugin in plugins if filter_params.produces.issubset(set(plugin.produces))]
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this actually allow for plugins that only produce one of the filtered produce values?
Eg, I filter on produces, X or Y. this plugin produces Y and Z.
X and y is not a subset of Y and Z. It does produce an intersect result which Is probably what we are looking for as filters are usually OR, not AND?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
plugins = [plugin for plugin in plugins if filter_params.produces.issubset(set(plugin.produces))]
plugins = [plugin for plugin in plugins if filter_params.produces.intersection(set(plugin.produces))]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps not relevant to the discussion, but the scheduler will only request one type.

@@ -70,6 +70,12 @@ def list_plugins(
# filter plugins by scan level for boefje plugins
plugins = [plugin for plugin in plugins if plugin.type != "boefje" or plugin.scan_level >= filter_params.scan_level]

if filter_params.consumes is not None:
plugins = [plugin for plugin in plugins if filter_params.consumes.issubset(set(plugin.consumes))]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
plugins = [plugin for plugin in plugins if filter_params.consumes.issubset(set(plugin.consumes))]
plugins = [plugin for plugin in plugins if filter_params.consumes.intersection(set(plugin.consumes))]

@jpbruinsslot jpbruinsslot marked this pull request as ready for review February 20, 2025 08:48
@jpbruinsslot jpbruinsslot requested a review from a team as a code owner February 20, 2025 08:48
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
29.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

Katalogus caching in the scheduler
3 participants