-
Notifications
You must be signed in to change notification settings - Fork 912
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): supporting enabled-only overwritten rules #1775
Conversation
The test Accordingly, this PR removes the |
e504919
to
e09a350
Compare
About exceptions, the docs may not state it, but you're not supposed to be able to append exceptions at the moment, only conditions. @sai-arigeli is working on a separate PR to change that: #1768. And about enabled, I'm not sure we want disable a rule by appending to it with a different enabled value. Is there a compelling use case for this? Why wouldn't redefining the original rule work? |
Hey @mstemm
Currently, it works neither 👇 Redefine
Append
I guess the reason why @jasondellaluce tried to fix the "append" case is that the official documentation advice it: https://falco.org/docs/rules/#via-custom-rule-definition I would correct both cases. In my opinion, In general, |
I don't think this strictly overlaps with #1768, as this is not correlated to rule exceptions. In that perspective, I only weakened the requirement of needing a condition or an exception in appended rules, in order to allow users to append rules defining only the
Users raised many issues about this (such as #1510 and #1537), since we indicate this as feasible in our doc (as @leogr said).
I agree with this. Some additional work is required for this, so I'm gonna wait until we are on the same page on this discussion before pushing some additional commit. |
After having discussed this privately, I'm ok with fixing only the redefinition case. Basically, what this PR should do is:
The @mstemm do you agree? |
This allows defining rules that simply enable/disable already defined rules, like the following: - rule: A rule enabled by default enabled: false - rule: A rule disabled by default enabled: true Signed-off-by: Jason Dellaluce <[email protected]>
…nly rules Signed-off-by: Jason Dellaluce <[email protected]>
…enabled flag only Signed-off-by: Jason Dellaluce <[email protected]>
…nabled flag only Signed-off-by: Jason Dellaluce <[email protected]>
Currently the rule loading code doesn't handle cases where append is false, and the only thing in the second rule definition is an enabled flag. Currently, if a rule/macro has append false, everything in the prior rule is discarded and only the properties in the new rule are used instead. So this would introduce a special case where a rule with append false and only an enabled flag changes the enabled value from the original rule, but otherwise everything in the original rule is used instead? I guess this is okay, but to me this seems like a problem where the docs are wrong, but we're changing the code to match the docs rather than fixing the docs. |
@mstemm The real point here is that users are asking to disable/enable a rule without modifying the default ruleset file (that is a very common use case) and we should provide a way to do that. The docs might be wrong in the how, but they are perfectly correct w.r.t. the need. For these reasons, my last proposal suggests fixing both the code and the docs. |
e09a350
to
7105528
Compare
I just refactored the PR trying to implement @leogr's proposal. For clarity, I also added two more integration tests that assert the expected behavior wit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jasondellaluce, 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 |
LGTM label has been added. Git tree hash: 4bb5471f374227d89c325b33e328897c58214440
|
/milestone 0.31.0 |
Ok, this seems like a reasonable way to handle this use case. Approved! |
Signed-off-by: Jason Dellaluce [email protected]
Co-authored-by: Leonardo Grasso [email protected]
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area engine
What this PR does / why we need it:
This enables overwriting rules by specifying their name and the
enabled
field only, so that users can easily enable/disable already-defined rules. The expected behavior is to be able to overwrite rules like the following (example from @leogr):The following issues currently prevent this from being supported:
condition
or anexception
field. However, this conceptually applies only to rules havingappend
set astrue
.enabled
flag only, which is a feature demanded by the community.Proof of this ambiguity can be seen in the current version of
falco-website
, which reports a non-working example: https://github.com/falcosecurity/falco-website/blob/4a7b5eb82027da5dadd50dc688c7ebd55c24bd9e/content/en/docs/rules/_index.md?plain=1#L263Which issue(s) this PR fixes:
Fixes #1537
Fixes #1510
Special notes for your reviewer:
See #1537 for additional context.
Does this PR introduce a user-facing change?: