Lesson 13 of 14 · 18m
Detection as Code: The Lifecycle
Rules in git, CI compile plus fixture tests, API deploys, and lifecycle states — so nothing lives only in a console edit history.
Open any mature SIEM's rule console and look at the edit history: anonymous changes from three admins ago, no explanation, no diff, no rollback. Someone widened a filter in June and the rule has been applauding the build server ever since. Then the org migrates SIEMs and discovers the detection program lived entirely in a vendor's database. Detection-as-code is the fix: rules are files in git, changes are reviewed, deployments are automated, and nothing lives only in a console.
The repo shape
The standard layout: one git repository of Sigma rules, plus the pieces that make them deployable.
detections/
rules/
credential_access/lsass-comsvcs-minidump.yml
lateral_movement/wmiprvse-spawns-shell.yml
pipelines/
splunk.yml # field mappings: Image → winlog.event_data.Image
sentinel.yml
tests/
fixtures/ # captured events: must_fire / must_stay_silentpipelines/ holds per-backend field mappings — the dialect — so the rules themselves stay stack-neutral. tests/fixtures/ holds captured events: real (sanitized) event exports from your atomic tests, split into samples the rule must fire on and benign lookalikes it must not.
The lifecycle
Every rule moves through states, and the state lives in the file (status: field plus a detection_level convention of your own):
- draft — written, not deployed anywhere
- experimental — deployed in report-only mode, baseline running (the tuning lesson's first step)
- stable — alerting, tested, fidelity tracked
- deprecated — retired; kept in git because the history is the institution's memory
Each state transition is a pull request with the evidence attached: the atomic test output, the baseline noise distribution, the FP sample that motivated a filter. "Quiet rules nobody reviewed" stops being a failure mode because quiet rules never existed in the repo — only reviewed edits did.
CI is where it earns the name
On every commit:
- Syntax/taxonomy lint —
sigma checkcatches malformed YAML and bad tag spelling before a human wastes a review. - Convert-compile per backend —
sigma convert -t splunk -p splunk.yml,-t kusto -p sentinel.yml, whatever you run (setup doessigma plugin install splunk kustofirst; sigma-cli ships zero backends andconvertstops atNo backends installedwithout them). A rule that doesn't compile doesn't ship, and you find out in CI rather than in the console at 2 a.m. - Fixture tests — run the converted query against stored events: the malicious sample must match, the benign must not. This is the atomic-test loop institutionalized — regression testing for detections.
- Deploy — via the SIEM's API: Sentinel's repos/CI-CD integration or analytics-rules API, Splunk's
savedsearches.conf/savedsearchREST endpoints, Elastic's detection-rules API. Console edits become either backported diffs or a sync that overwrites them — pick deliberately, document it, or your git history stops being the truth.
What it buys and what it costs
Buys: blame and rollback (git log is the audit trail the console never had), portability (the SIEM migration becomes "write a new pipeline file," not "rebuild the program"), review (a second engineer sees every filter), and honest history — tuning diffs are searchable evidence.
Costs: someone maintains the pipeline files when schemas drift, CI needs the fixture corpus kept honest, and there's a real discipline gap to close — an admin who hot-edits the console is now unilaterally forking production. The fix is cultural before it's technical: console edits get reverted by the next deploy, everyone knows it, and the PR is faster than the meeting anyway.
The practice
Move one rule — the one that's been silently edited twice — into a git repo with a CI job that converts it and tests it against two stored events. Deploy it via API. You've built the whole mechanism; everything after is repetition. When the migration or the audit arrives, the program you can git clone is the program you can prove.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Immich Had Fourteen Advisories and One Bug It Fixed Three Times
Immich's 2026 security record runs to fourteen advisories, and they cluster hard: the sharing features, the OAuth plumbing, and one login redirect parameter that took three separate fixes across eighty-three days. Plus the 3.0 migration traps still waiting for anyone who hasn't jumped yet.
Jellyfin's Threat Model Is Your Brother-in-Law
Four Jellyfin CVEs landed in 2026 and not one of them needs an admin account. One needs only the ability to name a file. Meanwhile Jellyfin 12 shipped in September, the version numbers stopped starting with 10, and every "am I patched" check you wrote is now wrong.
Node.js Fixed 16 Flaws in One Release. Most of Them Live in HTTP/2 and TLS.
The November 11 Node.js security releases fix 16 CVEs across the 26, 24 and 22 lines, seven of them rated high. Nearly all sit in HTTP/2 and TLS, where a remote client can crash a server, leak memory, or get past per-host client-certificate checks.
Next.js Shipped Seven Advisories and Six of Them Are the Cache
The November 2026 Next.js security release patches seven issues, and six live in the new Cache Components layer, the feature meant to make your app faster by remembering more. Three hit self-hosted next start specifically: the ones Vercel's own platform quietly absorbs.