detkit — unit-testing Sigma rules against sample events (would love feedback) #6159
ELSATOAH
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Something I kept hitting with detection-as-code: I can validate that a rule is well-formed Sigma, but that doesn't tell me whether it actually fires on the thing it's meant to catch, or whether it stays quiet on the benign logs sitting right next to it. That check usually happens by hand, or after the rule is already live in the SIEM.
So I built detkit to cover that gap. You keep a small test file next to each rule with sample events and what you expect to happen:
detkit test ./rulesevaluates each rule's condition against its events and exits non-zero on a mismatch, so it drops into CI or pre-commit and blocks a PR that breaks a detection. Basically dbt test, but for detections.A few notes:
Repo: https://github.com/ELSATOAH/detkit (MIT, pipx install detkit-cli)
Mostly I'd like to know how you all test detections today. Is a local, event-based test runner something that would fit your workflow, and what would it need to handle to earn a place in your CI? Very happy to hear that I've reinvented something or missed an obvious approach.
All reactions