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

fix(userspace/engine): actually make m_filter_all_event_types useful by properly using it as fallback when no filter event types is provided #1875

Merged
merged 2 commits into from
Jan 27, 2022

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Jan 27, 2022

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

If contributing rules or changes to rules, please make sure to also uncomment one of the following line:

/kind rule-update

/kind rule-create

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area rules

/area tests

/area proposals

What this PR does / why we need it:

Experimenting together with @jasondellaluce and @leogr a possible solution for falcosecurity/plugins#57

The issue was that m_filter_all_event_types was actually unused: for syscalls event source, we always have a m_filter_by_event_type value for the filter, event if evt.type is missing in the condition: in fact when it is missing, a default set of "all events" is used.

For k8s audit logs the bug is not appearing because its filter check provides a default evttypes() impl that basically means "force-use any event type", even when negated.

Plugins filter checks instead is returning PPME_PLUGINEVENT_E as only possible event associated; but, when rule condition gets negated, there is no other set of event type possible and thus the filter check gets added to m_filter_all_event_types.

Unfortunately, the old check in ruleset_filters::run:

if(evt->get_type() >= m_filter_by_event_type.size())
{
	return false;
}

prevented it to actually run the filterchecks stored in m_filter_all_event_types, de facto making it useless.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Edit by @leogr: we also bumped the json plugin version to include a fix for falcosecurity/plugins#56

Does this PR introduce a user-facing change?:

NONE

…by properly using it as fallback when no filter event types is provided.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@leogr
Copy link
Member

leogr commented Jan 27, 2022

Closing and reopening to trigger the CI
/close

@poiana
Copy link

poiana commented Jan 27, 2022

@leogr: Closed this PR.

In response to this:

Closing and reopening to trigger the CI
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@poiana poiana closed this Jan 27, 2022
@leogr
Copy link
Member

leogr commented Jan 27, 2022

/reopen

@poiana poiana reopened this Jan 27, 2022
@poiana
Copy link

poiana commented Jan 27, 2022

@leogr: Reopened this PR.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@leogr
Copy link
Member

leogr commented Jan 27, 2022

/milestone 0.31.1

@poiana
Copy link

poiana commented Jan 27, 2022

@leogr: The provided milestone is not valid for this repository. Milestones in this repository: [0.31.0, 0.32.0, 1.0.0]

Use /milestone clear to clear the milestone.

In response to this:

/milestone 0.31.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@FedeDP FedeDP changed the title wip: fix(userspace/engine): actually make m_filter_all_event_types useful by properly using it as fallback when no filter event types is provided fix(userspace/engine): actually make m_filter_all_event_types useful by properly using it as fallback when no filter event types is provided Jan 27, 2022
@jasondellaluce jasondellaluce mentioned this pull request Jan 27, 2022
51 tasks
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@leogr
Copy link
Member

leogr commented Jan 27, 2022

/milestone 0.31.0

@poiana poiana added this to the 0.31.0 milestone Jan 27, 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.

/approve

@poiana
Copy link

poiana commented Jan 27, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, leogr

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

@poiana
Copy link

poiana commented Jan 27, 2022

LGTM label has been added.

Git tree hash: f5626f16540d311539964ef38bc9e4b2e7514046

@poiana poiana merged commit ce3598f into falcosecurity:master Jan 27, 2022
@FedeDP FedeDP deleted the fix_ruleset_filters_run branch January 27, 2022 16:22
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.

None yet

4 participants