-
Notifications
You must be signed in to change notification settings - Fork 392
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: derived event not triggering if base filtered #3280
fix: derived event not triggering if base filtered #3280
Conversation
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.
nice catch!
Please cherry-pick to v0.16.0 branch as well
@@ -519,7 +519,7 @@ func (t *Tracee) deriveEvents(ctx context.Context, in <-chan *trace.Event) ( | |||
case events.PrintMemDump: | |||
default: | |||
// Derived events might need filtering as well | |||
if t.matchPolicies(&derivative) == 0 { | |||
if t.matchPolicies(&derivatives[i]) == 0 { |
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.
Good catch.
What about to remove the copied var usage above (derivative) and make all accesses via index to avoid further errors like that?
for i := range derivatives {
// Skip events that dont work with filtering due to missing types being handled.
// https://github.com/aquasecurity/tracee/issues/2486
switch events.ID(derivatives[i].EventID) {
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.
Good idea. This will also avoid the extra copy of creating derivative instance in the loop
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.
Good catch.
What about to remove the copied var usage above (derivative) and make all accesses via index to avoid further errors like that?
for i := range derivatives { // Skip events that dont work with filtering due to missing types being handled. // https://github.com/aquasecurity/tracee/issues/2486 switch events.ID(derivatives[i].EventID) {
And the code suggestion was just to get us on the same page. Please be my guest on code style or naming, nits, anything 😄.
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.
@geyslan can you review the change pls?
35cdc5e
to
7a58e77
Compare
7a58e77
to
538488a
Compare
1. Explain what the PR does
Fix #3279
The bug happens because we pass a different event to
matchPolicies
inside the for, instead of passing the event that goes down the pipeline, so the logic of changing the bitmap is lost, because it happened on different events.2. Explain how to test it
The
container_created
should be triggered but not thecgroup_mkdir
.3. Other comments