Skip to content

feat(enforcer): capability-specific alert throttling at BPF level - #2819

Open
Rucha0901 wants to merge 5 commits into
kubearmor:mainfrom
Rucha0901:capable-alert-throttling
Open

feat(enforcer): capability-specific alert throttling at BPF level#2819
Rucha0901 wants to merge 5 commits into
kubearmor:mainfrom
Rucha0901:capable-alert-throttling

Conversation

@Rucha0901

Copy link
Copy Markdown
Contributor

Purpose of PR?:

This PR implements granular, capability-specific alert throttling at the eBPF/LSM kernel level inside the lsm/capable hook (enforce_cap). By checking capability violations against a token-bucket rate limiter map keyed by container ID and capability number, we drop user-space alerts when the rate is exceeded while still enforcing the policy (-EPERM).

Fixes #2818

Does this PR introduce a breaking change?

No.

If the changes in this PR are manually verified, list down the scenarios covered::

  1. Verification of compilation: Built BPF programs and Go daemon successfully.
  2. Execution of unit tests: Verified Go test suite compiles and runs successfully using mock execution with GOOS=linux go test -exec=true ./....

Additional information for reviewer? :

Key modifications:

  • Defined struct cap_throttle_key and struct cap_throttle_state in throttling.h.
  • Declared BPF hash map kubearmor_capable_throttle in throttling.h.
  • Implemented should_drop_capable_alerts token-bucket rate limiting helper in shared.h.
  • Updated enforce_cap in enforcer.bpf.c to use should_drop_capable_alerts(okey, cap).
  • Defined Go-side structures and initialized/cleaned up BPFCapableThrottleMap in enforcer.go.
  • Implemented map iteration and cleanup for BPFCapableThrottleMap on container deletion in mapHelpers.go.

Checklist:

  • Bug fix. Fixes Alert Throttling for Capability Violations at the eBPF/LSM Kernel Level #2818
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • PR Title follows the Palace convention of <type>(<scope>): <subject>
  • Commit has unit tests
  • Commit has integration tests

Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
…PF code

Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
…nment

Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
@Rucha0901
Rucha0901 force-pushed the capable-alert-throttling branch from d666894 to 8e6fbb2 Compare August 1, 2026 11:20
Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
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.

Alert Throttling for Capability Violations at the eBPF/LSM Kernel Level

1 participant