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

Reject mismatched sources rules changes #3383

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mstemm
Copy link
Contributor

@mstemm mstemm commented Oct 16, 2024

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

/kind release

Any specific area of the project related to this PR?

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

/area build

/area engine

/area tests

/area proposals

/area CI

What this PR does / why we need it:
This fixes a bug where a second rule definition for a different source is mistakenly combined with the first rule definition of a different source. This now returns the same error as when defining a second rule.

Which issue(s) this PR fixes:

Fixes #3382

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Explicitly disallow appending/modifying a rule with different sources.

@poiana
Copy link
Contributor

poiana commented Oct 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mstemm

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 poiana requested a review from Kaizhe October 16, 2024 21:02
@poiana poiana requested a review from sgaist October 16, 2024 21:02
@poiana poiana added the size/L label Oct 16, 2024
Copy link

This PR may bring feature or behavior changes in the Falco engine and may require the engine version to be bumped.

Please double check userspace/engine/falco_engine_version.h file. See versioning for FALCO_ENGINE_VERSION.

/hold

@mstemm mstemm force-pushed the reject-mismatched-sources-rules-changes branch 11 times, most recently from dc56b3e to 181e45e Compare October 16, 2024 23:44
jasondellaluce
jasondellaluce previously approved these changes Oct 21, 2024
@poiana
Copy link
Contributor

poiana commented Oct 21, 2024

LGTM label has been added.

Git tree hash: f8e26de41c24d3e88628c14b6752eae961e09ed3

It's possible that someone might want to override a property for a
non-syscall rule source. To assist in this, decode any source property
for rules with append/override and save it in the rule_update_info
object. For the source property only, the value for source can be
empty e.g. 'source: ' or an empty string e.g. 'source: ""'. Both of
those are considered valid but result in an empty source.

A later change will ensure that the sources match up when
appending/redefining/overriding/enabling.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
In places where a second rule definition might replace, append to, or
replace items from a base rule, ensure that the source of the second
rule definiton matches the first.

This already existed for defines, but for other changes. There was a
bug where a second definition might exist for a different source, but
the additional rule was used anyway.

This now returns the same error for these other changes e.g. "Rule has
been re-defined..." as define.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
Add additional unit tests to verify that rule loading fails when a
second rules object has a different source but the name of an existing
rules object.

Also add tests for additional rules having an empty source.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
@mstemm mstemm force-pushed the reject-mismatched-sources-rules-changes branch from 181e45e to ff211ed Compare October 21, 2024 16:23
@poiana poiana removed the lgtm label Oct 21, 2024
@poiana
Copy link
Contributor

poiana commented Oct 21, 2024

New changes are detected. LGTM label has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Can mistakenly append to a base rule from a rule with a different source.
3 participants