Detection-as-Code Principles
Treating detections like software.
Why Detection-as-Code
Detection-as-Code (DaC) applies software engineering discipline to security detections. Instead of analysts hand-editing rules inside a SIEM console, detections live as text files in version control and ship through a pipeline.
The benefits are concrete:
- Reviewable changes via pull requests
- Reproducible deployments across environments
- Testable logic before it reaches production
- Auditable history of who changed what and why
A detection becomes an artifact you can diff, roll back, and reason about like any other code.
Detections as Versioned Files
Each detection is stored as a standalone file, typically YAML or a vendor query language, committed to a Git repository. The repository layout mirrors how you organize your coverage.
A common structure separates rules by platform and tactic:
detections/
windows/
credential_access/
lsass_memory_dump.yml
execution/
suspicious_powershell.yml
cloud/
aws/
root_account_usage.yml
tests/
windows/
lsass_memory_dump_test.ymlAll lessons in this course
- Detection-as-Code Principles
- Writing Sigma Rules
- Mapping to MITRE ATT&CK
- Testing and Tuning Detections