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

Merged
merged 3 commits into from
Oct 24, 2024

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?:

fix(userspace/engine): explicitly disallow appending/modifying a rule with different sources

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

@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 poiana requested a review from jasondellaluce October 21, 2024 16:23
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
@mstemm mstemm force-pushed the reject-mismatched-sources-rules-changes branch from ff211ed to 0f2ae34 Compare October 22, 2024 19:44
@poiana poiana added the lgtm label Oct 23, 2024
@poiana
Copy link
Contributor

poiana commented Oct 23, 2024

LGTM label has been added.

Git tree hash: f0440bfccf20a2bd61217d01cf79b9722030a6d0

Copy link
Contributor

@FedeDP FedeDP 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 Oct 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, 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

@FedeDP
Copy link
Contributor

FedeDP commented Oct 24, 2024

/milestone 0.40.0

@poiana poiana added this to the 0.40.0 milestone Oct 24, 2024
@FedeDP
Copy link
Contributor

FedeDP commented Oct 24, 2024

/unhold

@poiana poiana merged commit 09a9fd4 into master Oct 24, 2024
36 checks passed
@poiana poiana deleted the reject-mismatched-sources-rules-changes branch October 24, 2024 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

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