Detection as Code
Ship detections through a pipeline, not a console
A detection written in a SIEM console has no history, no test, no review, and no rollback. When it breaks in production, nobody can tell you who changed it or why. This course teaches you to manage detection content the way a software team manages code: every rule version-controlled, peer-reviewed, automatically tested against committed fixtures, and deployed to your SIEM through a pipeline that proves it works before it reaches production. You write each rule once in Sigma and ship it to Sentinel, Splunk, or Elastic without clicking through a console.
What you'll be able to do
Course Syllabus
Every module and every lesson. The first three modules are open; the rest open on a click.
Download the full syllabus (PDF)
Phase 1: Foundations
What Detection as Code teaches: write detections in Sigma, test them against committed fixtures, gate them on CI, and deploy them to any SIEM through a pipeline you own. The discipline, the toolchain, the repository you build, and how the course is structured. Start here.
Author Sigma detection rules from scratch: the rule anatomy, the logsource taxonomy that targets the right events, the field maps and lists that express matching, the modifier system, the condition language, and correlation rules. By the end you write and validate a rule with sigma-cli.
Show 12 lessonsHide lessons
- 1.1DC1.1 Anatomy of a Rule
- 1.2DC1.2 Logsource: Targeting the Right Events
- 1.3DC1.3 The Detection Block
- 1.4DC1.4 Modifiers
- 1.5DC1.5 The Condition Expression
- 1.6DC1.6 Correlation Rules
- 1.7DC1.7 Regex and Special-Character Handling
- 1.8DC1.8 Placeholders and Value Lists
- 1.9DC1.9 Rule Collections
- 1.10DC1.10 Write and Validate a Rule End to End
- 1.11Module Summary
- 1.12Check My Knowledge
Phase 2: The Detection Repository
Turn a pile of rule files into a detection library: a repository layout that encodes tactic, the rule-test-documentation contract, a metadata standard enforced repo-wide, and naming and identity that hold at scale. The structure the rest of the pipeline reasons about.
Show 12 lessonsHide lessons
- 2.1DC2.1 The Repository as a System
- 2.2DC2.2 The Rule-Test-Documentation Contract
- 2.3DC2.3 The Metadata Standard
- 2.4DC2.4 Naming and Identity at Scale
- 2.5DC2.5 Templates and the Cost of Compliance
- 2.6DC2.6 Documenting a Detection
- 2.7DC2.7 Rule Relationships and the related Field
- 2.8DC2.5 Organizing at Scale and the Build-Time Payoff
- 2.9DC2.9 The Detection Repository as a Sensitive Asset
- 2.10DC2.6 Lay Out the NE Detection Repository
- 2.11Module Summary
- 2.12Check My Knowledge
Manage detection content as code: a branching model that keeps main always deployable, commit hygiene that makes the history an audit trail, the pull request as the review surface for a detection, why detection review is its own discipline, and CODEOWNERS routing approvals by tactic.
Show 12 lessonsHide lessons
- 3.1DC3.1 Git as the Detection Control Plane
- 3.2DC3.2 A Branching Model for Detections
- 3.3DC3.3 Commit Hygiene and History as Audit Trail
- 3.4DC3.4 Reading the History: log, blame, and bisect
- 3.5DC3.5 Merge Conflicts as Detection Decisions
- 3.6DC3.6 The Pull Request as Review Surface
- 3.7DC3.7 Why Detection Review Is Its Own Discipline
- 3.8DC3.8 CODEOWNERS and Routing
- 3.9DC3.9 Branch Protection
- 3.10DC3.10 Build: Take a Change Through the Whole Workflow
- 3.11Module Summary
- 3.12Check My Knowledge
Turn portable Sigma source into the query your SIEM actually runs. The sigma-cli and pySigma toolchain, converting one rule to KQL, SPL, and Elastic, processing pipelines that map fields and tables, pipelines as version-controlled code, and where conversion breaks.
Show 13 lessonsHide lessons
- 4.1DC4.1 Why Portable Source Needs Conversion
- 4.2DC4.2 The Conversion Toolchain: sigma-cli and pySigma
- 4.3DC4.3 One Rule, Three Backends
- 4.4DC4.4 The Processing Pipeline: Field and Table Mapping
- 4.5DC4.5 Pipelines as Code
- 4.6DC4.6 Where Conversion Breaks
- 4.7DC4.7 Backend Differences That Change Detection Meaning
- 4.8DC4.8 Native Rule Formats Versus Plain Queries
- 4.9DC4.9 Converting the Whole Repository
- 4.10DC4.10 Build: Convert the NE Rule Set to the Team's Backends
- 4.11DC4.11 Performance and Cost-Aware Conversion
- 4.12Module Summary
- 4.13Check My Knowledge
Phase 3: The Pipeline
A rule that converts cleanly can still be dead on arrival. Fixture-based testing: true-positive and benign-baseline events, a hand-built test harness, Atomic Red Team as a fixture source, and fixtures committed with the rule they prove.
Show 12 lessonsHide lessons
- 5.1DC5.1 Why Conversion Isn't Enough
- 5.2DC5.2 Fixture Anatomy
- 5.3DC5.3 Writing True-Positive Fixtures
- 5.4DC5.4 Writing Benign-Baseline Fixtures
- 5.5DC5.5 Building the Test Harness
- 5.6DC5.6 Atomic Red Team as a Fixture Source
- 5.7DC5.7 Running the Suite, Reading the Output
- 5.8DC5.8 Fixture Quality
- 5.9DC5.9 Fixtures Committed with the Rule
- 5.10DC5.10 Build a Tested Rule End-to-End
- 5.11Module Summary
- 5.12Check My Knowledge
A suite that only runs when someone remembers to run it protects nothing. GitHub Actions: lint, convert, test, and block a bad rule from merging, built as the actual workflow YAML rather than described in the abstract.
Show 12 lessonsHide lessons
- 6.1DC6.1 Why CI Rather Than a Local Script
- 6.2DC6.2 GitHub Actions Fundamentals
- 6.3DC6.3 The Lint Stage
- 6.4DC6.4 The Convert Stage
- 6.5DC6.5 The Test Stage
- 6.6DC6.6 Block on Failure
- 6.7DC6.7 Caching and Performance
- 6.8DC6.8 Reading a Failed CI Run
- 6.9DC6.9 What a Reviewer Sees
- 6.10DC6.10 Build the Workflow End to End
- 6.11Module Summary
- 6.12Check My Knowledge
A merged rule that a person still pastes into a portal is not deployed. This module builds the stage that carries a rule from the repository into a live SIEM, the credential that stage needs, and the rollback that makes automating it survivable.
Show 12 lessonsHide lessons
- 7.1DC7.1 The Last Manual Step
- 7.2DC7.2 What a Deployed Rule Actually Is
- 7.3DC7.3 The Sentinel Deployment Artifact
- 7.4DC7.4 The Splunk Deployment Artifact
- 7.5DC7.5 The Secret You Must Not Commit
- 7.6DC7.6 OIDC: The Credential That Does Not Exist
- 7.7DC7.7 Least-Privilege Scoping
- 7.8DC7.8 The Deploy Job
- 7.9DC7.9 Environment Promotion
- 7.10DC7.10 Rollback, Drift, and the Complete Workflow
- 7.11Module Summary
- 7.12Check My Knowledge
Phase 4: Operating the Program
A coverage map maintained by hand is out of date the moment a rule merges. This module generates the coverage layer from the rules themselves: an inventory from rule metadata, an ATT&CK Navigator layer as a build artifact, gap analysis from the inventory, and the loop from a gap to the next rule request.
Show 10 lessonsHide lessons
- 8.1DC8.1 Coverage as a Computed Property
- 8.2DC8.2 The Technique Tag Is the Datum
- 8.3DC8.3 Reading the Rule Set Into an Inventory
- 8.4DC8.4 Generating a Navigator Layer
- 8.5DC8.5 Scoring Coverage Honestly
- 8.6DC8.6 Gap Analysis From the Inventory
- 8.7DC8.7 From a Gap to a Rule Request
- 8.8DC8.8 Build: The Coverage Layer in CI
- 8.9Module Summary
- 8.10Check My Knowledge
A false positive is a signal, not a failure. Tuning a rule through the same pull request flow as any change, suppression and allowlists as versioned code, and the honest limit of Sigma: the expressiveness ceiling and the native-detection escape hatch, where a rule legitimately lives as KQL or SPL.
Show 10 lessonsHide lessons
- 9.1DC9.1 A False Positive Is a Signal
- 9.2DC9.2 Tuning as a Reviewed Change
- 9.3DC9.3 Refine or Suppress
- 9.4DC9.4 Suppression and Allowlists as Code
- 9.5DC9.5 Versioning a Tuning Change
- 9.6DC9.6 Where Sigma Stops
- 9.7DC9.7 The Native-Detection Escape Hatch
- 9.8DC9.8 Build: Tune a Rule and Take One Native
- 9.9Module Summary
- 9.10Check My Knowledge
A rule set nobody measures rots silently. Rule health pulled from the repo and the SIEM, coverage drift over time, the maturity gradient that tells you how much pipeline your org actually needs, and the RACI and cross-team flow that make a detection program run.
Show 10 lessonsHide lessons
- 10.1DC10.1 A Rule Is Not Done When It Ships
- 10.2DC10.2 Rule Health from the Repo
- 10.3DC10.3 Rule Health from the SIEM
- 10.4DC10.4 The Rule-Health Report
- 10.5DC10.5 Coverage Drift Over Time
- 10.6DC10.6 The Maturity Gradient
- 10.7DC10.7 RACI and the Operating Model
- 10.8DC10.8 Cross-Team Flow
- 10.9Module Summary
- 10.10Check Your Knowledge
Phase 5: Capstone
The whole lifecycle in one assessment. A new threat lands with no coverage, and you carry it through every stage you built: Sigma rule, fixtures, tests, pull request, CI, deployment, coverage layer, and rule-health entry. One detection, shipped end to end.
Phase 0: Course Resources
The Sigma syntax, the Git operations, the pipeline stages and the failure modes, one sheet per part of the system.
Show 12 lessonsHide lessons
Ordered procedures for building the pipeline, each stopping where the value stops rather than where the method ends.
A working repository, pipeline and deployment path built from nothing, with every silent failure produced deliberately.
Detection engineering reasoned end to end, including the cases where the pipeline was green and the answer was still no.
What to do when the pipeline fails, a rule turns out dead, drift appears, or somebody asks for a rule you cannot write.
Every practice surface available for this course, what each one gives you, and where the gaps are.
Sigma, pySigma, ATT&CK, Atomic Red Team, DeTT&CT, and the backend and CI documentation used throughout the Detection as Code course, organized by category.
Course Completion
Detection as Code end-of-course exam: a scenario-based assessment testing whether you can carry a new detection through the full pipeline, from a threat you have not seen to a deployed, measured rule, using the method built across all twelve modules.
Show 1 lessonHide lessons
Course overview
Detection as Code teaches you to operate detection content as engineered software. You build a working pipeline in your own GitHub account, from the first Sigma rule through automated SIEM deployment, and you keep everything you build. Learn how to:
By the end you own a detection pipeline that answers who changed any rule, when, and why, and that proves every detection works before it ships.
How this course works
Detection as code is version control, testing and deployment applied to detection content. This course runs the same loop for every rule it ships.
1. Author once, in a source format. Sigma is the source of truth and the backend query is a build artifact. Editing the deployed query is how a repository and a SIEM drift apart.
2. Put it under review like code. A branch, a diff, a second pair of eyes. A rule change nobody reviewed is a production change nobody reviewed.
3. Test in CI, not after deployment. Syntax, conversion and logic checks that run on every commit. The pipeline is what makes the review meaningful rather than ceremonial.
4. Deploy from the pipeline. If a rule can reach production by hand, the repository is a record of intentions rather than of what is running.
5. Measure coverage from the repository. Coverage computed from what is deployed, with a stated denominator, rather than from a spreadsheet somebody maintains separately.
The course closes by shipping a detection end to end through the pipeline you built.
What this course assumes
No minimum experience and no prerequisite course. Git, YAML, CI concepts and the conversion model are introduced from nothing, and the course assumes you are a detection engineer rather than a developer.
What makes it go faster: a Git host you can push to and a SIEM to deploy into. Neither is required; the pipeline is built and run locally throughout.
What this course does not cover: writing detection logic in depth, which is its own course, and SIEM administration. This is the engineering practice around the rules.
Who this course is for
You are a detection engineer, SOC analyst, or security automation engineer who can already write a detection but manages rules by hand in a console. You want the engineering discipline around your detection content. Detection-engineering team leads building a sustainable program belong here, as do platform engineers asked to stand up a detection pipeline. The course is self-contained, every concept explained at first use. It is for you if you want to:
What you'll learn
By the end of Detection as Code you will be able to:
Key course takeaways
Things you need to know
What are the prerequisites for this course?
Comfort reading a SIEM query (KQL or SPL), basic command-line use, and willingness to use Git. No prior Git, Sigma, or CI/CD experience is required. Each is taught at first use, and an experienced reader can skip past what they already know.
Do I need a SIEM?
Not for most of the course. The testing and CI modules work entirely against committed fixtures in your GitHub repository. The deployment module (M7) offers parallel tracks for Sentinel and Splunk so you can follow whichever platform you have. If you have neither, you still build and test the full pipeline; only the live-deployment step is deferred until you have a target.
How does this relate to SEC401 (Detection Engineering)?
SEC401 teaches you to author high-quality detections in Sentinel and KQL. SEC407 teaches you to manage detection content as code across any backend. A student can take either independently; together they cover authoring and operating. Neither is a prerequisite for the other.
How will the course benefit your career?
Detection-as-code is the direction every mature SOC is heading, and the cybersecurity professionals who can stand up and operate the pipeline are in short supply. The vendor-neutral approach means the skill travels with you regardless of which SIEM an employer runs. You finish with a working pipeline you can demonstrate in an interview or deploy at your next organization.
Usage rights and disclaimer
Course materials: Licensed for individual professional development. You may not redistribute course content or share account credentials.
Fictional environment: All scenarios use Northgate Engineering. Any resemblance to real organizations is coincidental.
End of Course Exam
Complete the course, then prove your skills under time pressure. Pass mark: 70. Earn your certificate with CPE credits.
One random scenario per attempt. Certificate issued on pass.