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

vdk-audit: [bug fix] Fix incorrectly detected event #2548

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

doks5
Copy link
Contributor

@doks5 doks5 commented Aug 10, 2023

The logic in the _audit() method filters the forbidden events and detects if an executed event is allowed or not. However, the way it matches the events is by partial string match (the event in not_permitted_event part). This means that if a forbidden event is, e.g., os.removexattr and the event that is passed to the method is os.remove, there will be a match, because os.remove is a sub-string of os.removexattr.

With this change, the _audit() method switches to exact string match when filtering for forbidden events, in order to avoid situations where unexpected events are matched.

Testing done: Added test

The logic in the `_audit()` method filters the forbidden events and detects if an
executed event is allowed or not. However, the way it matches the events is by partial
string match (the `event in not_permitted_event` part). This means that if a forbidden
event is, e.g., `os.removexattr` and the event that is passed to the method is `os.remove`,
there will be a match, because `os.remove` is a sub-string of `os.removexattr`.

With this change, the `_audit()` method switches to exact string match when filtering
for forbidden events, in order to avoid situations where unexpected events are matched.

Testing done: Added test

Signed-off-by: Andon Andonov <[email protected]>
@doks5 doks5 self-assigned this Aug 10, 2023
@doks5 doks5 merged commit d2ef7d9 into main Aug 10, 2023
@doks5 doks5 deleted the person/andonova/audit-plugin-fix branch August 10, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants