ROX-33034: Track xattr changes#790
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds end-to-end tracking of ChangesXattr tracking feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #790 +/- ##
==========================================
- Coverage 27.96% 27.52% -0.45%
==========================================
Files 21 21
Lines 2596 2638 +42
Branches 2596 2638 +42
==========================================
Hits 726 726
- Misses 1867 1909 +42
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@fact-ebpf/src/bpf/main.c`:
- Around line 434-443: The trace_inode_removexattr function has an unreachable
return statement. After the return handle_xattr(...) call on line 441, there is
a duplicate return 0; statement that serves as dead code. Remove the duplicate
return 0; statement that appears after the handle_xattr return, keeping only the
return handle_xattr(...) line to ensure the function properly returns the result
of the xattr handler call.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Enterprise
Run ID: 461c91e6-bfc7-42e7-97f6-99a4157926c8
📒 Files selected for processing (8)
fact-ebpf/src/bpf/events.hfact-ebpf/src/bpf/main.cfact-ebpf/src/bpf/types.hfact-ebpf/src/lib.rsfact/src/event/mod.rsfact/src/host_scanner.rsfact/src/metrics/kernel_metrics.rstests/test_inode_xattr.py
Molter73
left a comment
There was a problem hiding this comment.
As discussed offline, we should make the protobuf changes for supporting xattr as part of these changes, so I expect some changes incoming.
There are also 2 small comments on the eBPF code.
| // inode hooks don't provide a struct path, so filename is left empty. | ||
| // __submit_event requires a valid pointer for bpf_probe_read_str. | ||
| struct bound_path_t* bound_path = get_bound_path(BOUND_PATH_MAIN); | ||
| if (bound_path == NULL) { | ||
| args.metrics->error++; | ||
| return 0; | ||
| } | ||
| bound_path->path[0] = '\0'; | ||
| args.filename = bound_path->path; |
There was a problem hiding this comment.
Would it be too complicated to change the behavior of __submit_event to check whether the path is valid?
|
|
||
| #define LINEAGE_MAX 2 | ||
|
|
||
| // Matches Linux kernel XATTR_NAME_MAX (255) + null terminator |
There was a problem hiding this comment.
Can you get a github or elixir.bootlin to where this definition is?
Description
Adds tracking for setting and removing xattr. For now this only adds metrics for xattr events. In the future gRPC messages will be sent to sensor when these event occur. Sending gRPC messages to sensor will require changes to the stackrox/stackrox protobuf definitions and will be done later. The added integration tests rely on metrics. Once gRPC messages are sent the integration tests will not check the metrics and will instead check the gRPC messages.
Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
CI is sufficient
Summary by CodeRabbit
Release Notes
New Features
Tests