-
Notifications
You must be signed in to change notification settings - Fork 449
Feature/event context filter #2229
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
Feature/event context filter #2229
Conversation
1768bb0
to
b400a9c
Compare
0c8c668
to
9c69eb3
Compare
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.
I love it!
Any info about how does it affects performance?
cmd/tracee-ebpf/flags/filter.go
Outdated
Event context fields can be accessed using 'event_name.context.field', this can be used to filter an event by its standard fields. | ||
Refer to the json field values in github.com/aquasecurity/tracee/blob/main/types/trace/trace.go and the standard filter fields for valid context fields. |
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.
It's not so clear what are the "standard fields".
I would also refer to the types/trace package instead of giving the full url (which might change) and be more specific about where to look - e.g. the Event struct.
Actually, refering (and updating) the docs would have been even better
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.
I meant existing fields in the examples (except the arguments), so maybe that's what I should write here.
And yes I'll refer to the package and struct instead I understand your point on the URL.
I included a docs update as part of this PR, but only an example, so I'll double check where I can also write more about the filter itself (though i'm not sure we have this for other filters).
The context filter takes filter expressions based on trace.Event non argument values. For example one can trace only for openat events if they originate in a the ls process with `-t openat.context.processName=ls`.
1. Move the function to the event pipeline. 2. Merge the context filter into the logic, short circuiting it before argument filtering.
9c69eb3
to
2063aef
Compare
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
Initial Checklist
Description (git log)
commit 617c4f9
commit cbe4c3c (BREAKING CHANGE @yanivagman)
commit 9b02477
Fixes: #1830
Type of change
How Has This Been Tested?
Currently manually, unit tests should be added soon
Run
tracee-ebpf -t e=openat -t openat.context.processName=ls
then run
ls
This should be equivalent to
tracee-ebpf -t e=openat -t comm=ls
Further confirmation can be done using the case presented in the issue.
Another interesting usecase is with
-t eventname.context.container
For example
-t security_file_open.context.container
then start a running container and notice no security_file_open events beforehands should be displayed.Final Checklist:
Pick "Bug Fix" or "Feature", delete the other and mark appropriate checks.
Git Log Checklist:
My commits logs have: