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

update(userspace/engine): introduce new check_plugin_requirements API #2009

Merged
merged 2 commits into from
May 24, 2022

Conversation

Andreagit97
Copy link
Member

Signed-off-by: Andrea Terzolo andrea.terzolo@polito.it

What type of PR is this?

/kind cleanup

/kind feature

Any specific area of the project related to this PR?

/area engine

What this PR does / why we need it:

This PR introduces a new check_plugin_requirements API instead of the old is_plugin_compatible to check if a list of plugins satisfies all the version requirements.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
Copy link
Contributor

@jasondellaluce jasondellaluce left a comment

Choose a reason for hiding this comment

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

This is great! Just left a minor indentation suggestion.

userspace/falco/app_actions/load_rules_files.cpp Outdated Show resolved Hide resolved
@jasondellaluce
Copy link
Contributor

I think this fix deserves some additional context. The current plugin/rules loading works as follows:

  • The Falco Engine loads ruleset files and collects plugin version requirements (e.g. required_plugin_versions)
  • Falco loads all the plugins depending on its configuration
  • For each loaded plugin, Falco checks if it is compatible with the version requirements in the engine

This logic has the simple flow that Falco is not able to find out if the loaded rules require a certain plugin/version that has not been configured to be loaded. For instance, this would cause the aws_cloudtrail default ruleset to throw an unknown field json.value error at loading time if the json plugin is not configured to be loaded. This is an implicit and non-expressive way of failing.

This PR proposes a fix for this by letting the Engine perform all the check, and ensures that all rules-plugins dependencies are satisfied at loading time.

Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>

Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
@Andreagit97
Copy link
Member Author

I think this fix deserves some additional context. The current plugin/rules loading works as follows:

* The Falco Engine loads ruleset files and collects plugin version requirements (e.g. `required_plugin_versions`)

* Falco loads all the plugins depending on its configuration

* For each loaded plugin, Falco checks if it is compatible with the version requirements in the engine

This logic has the simple flow that Falco is not able to find out if the loaded rules require a certain plugin/version that has not been configured to be loaded. For instance, this would cause the aws_cloudtrail default ruleset to throw an unknown field json.value error at loading time if the json plugin is not configured to be loaded. This is an implicit and non-expressive way of failing.

This PR proposes a fix for this by letting the Engine perform all the check, and ensures that all rules-plugins dependencies are satisfied at loading time.

Thank you @jasondellaluce for the additional context, I forgot to add it 😄

Copy link
Contributor

@jasondellaluce jasondellaluce left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented May 23, 2022

LGTM label has been added.

Git tree hash: 4764457a0efe76b4bde24ae98a675c08352e342e

@poiana
Copy link
Contributor

poiana commented May 23, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, jasondellaluce

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@FedeDP FedeDP mentioned this pull request May 24, 2022
53 tasks
@jasondellaluce jasondellaluce added this to the 0.32.0 milestone May 24, 2022
Copy link
Member

@leogr leogr left a comment

Choose a reason for hiding this comment

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

LGTM

@poiana poiana merged commit 3a3d5df into falcosecurity:master May 24, 2022
@Andreagit97 Andreagit97 deleted the plugin_requirements branch October 15, 2022 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants