Skip to content

feat: add container / host event scope to ruleset - #396

Open
biscout42 wants to merge 5 commits into
fix-container-linkfrom
feat-container-event-scope
Open

biscout42 wants to merge 5 commits into
fix-container-linkfrom
feat-container-event-scope

Conversation

@biscout42

@biscout42 biscout42 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

The change allows to filter host events vs container events.

@biscout42
biscout42 requested a review from a team as a code owner August 20, 2026 12:43
@biscout42
biscout42 changed the base branch from main to fix-container-link August 20, 2026 12:44
@biscout42 biscout42 changed the title feat container event scope feat: add container / host event scope to ruleset Aug 20, 2026

@Tacklebox Tacklebox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it makes sense to write rules based on container.id outside of the special case of LXC, since the ids won't be known at the time when the policy is written since they are generated at runtime right? I don't see any technical issues with the PR though.

christos68k
christos68k previously approved these changes Aug 20, 2026
@biscout42
biscout42 marked this pull request as draft August 21, 2026 13:30
@biscout42

Copy link
Copy Markdown
Contributor Author

I'll update this logic when #395 is done.

Comment thread quark.c
@biscout42

Copy link
Copy Markdown
Contributor Author

@Tacklebox , the use case here is to separate container events for k8s vs host events.

@biscout42
biscout42 force-pushed the feat-container-event-scope branch from 71a6c42 to bee3016 Compare September 16, 2026 11:38
@biscout42
biscout42 force-pushed the feat-container-event-scope branch from bee3016 to 912c965 Compare September 16, 2026 12:12
@biscout42
biscout42 force-pushed the feat-container-event-scope branch from 912c965 to 4be0a32 Compare September 16, 2026 12:49
@biscout42
biscout42 force-pushed the feat-container-event-scope branch 2 times, most recently from 0f47f2c to f862add Compare September 16, 2026 13:58
@biscout42
biscout42 force-pushed the feat-container-event-scope branch from f862add to 3462c37 Compare September 16, 2026 14:34
@biscout42
biscout42 force-pushed the feat-container-event-scope branch 2 times, most recently from 571ead4 to 8b39587 Compare September 16, 2026 18:29
@biscout42
biscout42 removed the request for review from Tacklebox September 16, 2026 18:30
@biscout42
biscout42 marked this pull request as ready for review September 17, 2026 10:08
christos68k
christos68k previously approved these changes Sep 18, 2026

@christos68k christos68k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some documentation nits for clarity.

LGTM

Comment thread CHANGES
Comment thread quark-mon.8
@biscout42
biscout42 force-pushed the feat-container-event-scope branch from 2232936 to 74c480a Compare September 21, 2026 08:32
christos68k
christos68k previously approved these changes Sep 21, 2026
@biscout42
biscout42 force-pushed the feat-container-event-scope branch from 74c480a to 75695b1 Compare September 23, 2026 12:42
@biscout42
biscout42 force-pushed the feat-container-event-scope branch 2 times, most recently from 98b200e to 0f62fa1 Compare September 25, 2026 08:29
biscout42 and others added 5 commits September 25, 2026 19:17
process_set_cgroup keeps the cached container ID when the new cgroup
does not name a container. The test moved a container process to a
host cgroup and expected the host rule to match.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
process_container_id never returns an empty string, so drop the
empty-string checks. The kprobe backend does not report the cgroup of
new processes, note this in the man page and CHANGES. Move the CHANGES
entry to the end of the 0.8 section to follow the file order.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The host rule matched every process without a container ID, including
processes with no cgroup at all. On the kprobe backend, and for eBPF
processes first seen through setsid, setuid or setgid, the cgroup is
unknown, so container events matched the host rule. Match neither
scope when the cgroup is unknown or not yet parsed.

Document that only the last cgroup component is parsed and that
nested cgroups match host.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@biscout42
biscout42 force-pushed the feat-container-event-scope branch from 0f62fa1 to f1ba260 Compare September 25, 2026 17:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants