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.

Included with Premium, from $19.99/month, or $179/year and save 25%. Preview the first module free, no account needed.
Your subscription also includes the Practice Hub: graded scenarios, forensic cases, query drills and the response playbooks.
View Pricing Take End of Course Exam → 40 CPE Credits

What you'll be able to do

✓Write detections once in Sigma and convert them to KQL, SPL, and Elastic with sigma-cli and pySigma
✓Prove every rule against committed true-positive and benign fixtures before it reaches production
✓Build a GitHub Actions CI pipeline that lints, converts, tests, and blocks a non-passing rule from merging
✓Deploy merged rules to Sentinel or Splunk automatically from source, keyed to a stable rule id, with rollback
✓Track ATT&CK coverage from the rule repository and measure rule health from pipeline data
✓Match the pipeline depth to your team's scale with the maturity gradient, and operate detection content as engineered software
SEC407 | Advanced tier | 12 modules across 5 phases | 36–40 hours at your own pace | 40 CPE credits

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

Module 0Course OrientationCourse Preview

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.

Show 5 lessonsHide lessons
  1. 0.1DC0.1 What Detection as Code IsPreview
  2. 0.2DC0.2 Sigma, and a Rule That ConvertsPreview
  3. 0.3DC0.3 The Pipeline, and What You BuildPreview
  4. 0.4DC0.4 Lab Environment and ToolingPreview
  5. 0.5DC0.5 Course Structure and How to StudyPreview
Module 1Sigma as the Source Format

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. 1.1DC1.1 Anatomy of a Rule
  2. 1.2DC1.2 Logsource: Targeting the Right Events
  3. 1.3DC1.3 The Detection Block
  4. 1.4DC1.4 Modifiers
  5. 1.5DC1.5 The Condition Expression
  6. 1.6DC1.6 Correlation Rules
  7. 1.7DC1.7 Regex and Special-Character Handling
  8. 1.8DC1.8 Placeholders and Value Lists
  9. 1.9DC1.9 Rule Collections
  10. 1.10DC1.10 Write and Validate a Rule End to End
  11. 1.11Module Summary
  12. 1.12Check My Knowledge

Phase 2: The Detection Repository

Phase 3: The Pipeline

Phase 4: Operating the Program

Module 8Coverage as Code

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
  1. 8.1DC8.1 Coverage as a Computed Property
  2. 8.2DC8.2 The Technique Tag Is the Datum
  3. 8.3DC8.3 Reading the Rule Set Into an Inventory
  4. 8.4DC8.4 Generating a Navigator Layer
  5. 8.5DC8.5 Scoring Coverage Honestly
  6. 8.6DC8.6 Gap Analysis From the Inventory
  7. 8.7DC8.7 From a Gap to a Rule Request
  8. 8.8DC8.8 Build: The Coverage Layer in CI
  9. 8.9Module Summary
  10. 8.10Check My Knowledge
Module 9Tuning and the Feedback Loop

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
  1. 9.1DC9.1 A False Positive Is a Signal
  2. 9.2DC9.2 Tuning as a Reviewed Change
  3. 9.3DC9.3 Refine or Suppress
  4. 9.4DC9.4 Suppression and Allowlists as Code
  5. 9.5DC9.5 Versioning a Tuning Change
  6. 9.6DC9.6 Where Sigma Stops
  7. 9.7DC9.7 The Native-Detection Escape Hatch
  8. 9.8DC9.8 Build: Tune a Rule and Take One Native
  9. 9.9Module Summary
  10. 9.10Check My Knowledge
Module 10Rule Health and Operating Model

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
  1. 10.1DC10.1 A Rule Is Not Done When It Ships
  2. 10.2DC10.2 Rule Health from the Repo
  3. 10.3DC10.3 Rule Health from the SIEM
  4. 10.4DC10.4 The Rule-Health Report
  5. 10.5DC10.5 Coverage Drift Over Time
  6. 10.6DC10.6 The Maturity Gradient
  7. 10.7DC10.7 RACI and the Operating Model
  8. 10.8DC10.8 Cross-Team Flow
  9. 10.9Module Summary
  10. 10.10Check Your Knowledge

Phase 5: Capstone

Module 11Capstone: Ship a Detection End to End

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.

Show 8 lessonsHide lessons
  1. 11.1DC11.1 The Threat and the Rule
  2. 11.2DC11.2 Fixtures and Tests
  3. 11.3DC11.3 The Pull Request and CI
  4. 11.4DC11.4 Deployment
  5. 11.5DC11.5 Coverage and Health
  6. 11.6DC11.6 What You Built
  7. 11.7Capstone Summary
  8. 11.8Check Your Knowledge

Phase 0: Course Resources

ResourcesCookbooks

Ordered procedures for building the pipeline, each stopping where the value stops rather than where the method ends.

Show 7 lessonsHide lessons
  1. 1Standing Up the Repository
  2. 2Making the Rules Testable
  3. 3Automating Deployment
  4. 4Measuring Coverage Honestly
  5. 5Tuning Without Losing the Detection
  6. 6Migrating to a New SIEM
  7. 7Answering an Auditor
ResourcesLab Setup

A working repository, pipeline and deployment path built from nothing, with every silent failure produced deliberately.

Show 5 lessonsHide lessons
  1. 1Building the Repository
  2. 2Building the Pipeline
  3. 3Producing the Silent Failures
  4. 4Deploying and Drifting
  5. 5Verify, and What the Lab Cannot Teach
ResourcesWalkthroughs

Detection engineering reasoned end to end, including the cases where the pipeline was green and the answer was still no.

Show 6 lessonsHide lessons
  1. 1The Green Pipeline Over Dead Rules
  2. 2The Rule That Could Not Be Written
  3. 3The Coverage Figure That Was Wrong
  4. 4The Rule Nobody Should Have Tuned
  5. 5The Detection That Was Not There
  6. 6The Migration Estimate
ResourcesPlayground

Every practice surface available for this course, what each one gives you, and where the gaps are.

ResourcesReferences & Further Reading

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

CompletionCourse Exam

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
  1. 1Course Completion. Detection as Code

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:

✓ Write detections in Sigma and convert them to KQL, SPL, and Elastic with sigma-cli and pySigma
✓ Test every rule against committed true-positive fixtures and benign baseline before it reaches production
✓ Build a GitHub Actions CI workflow that lints, converts, tests, and blocks a non-passing rule from merging
✓ Deploy merged rules to Sentinel or Splunk automatically, with rollback when a rule misfires
✓ Track ATT&CK coverage from the repo and measure rule health from pipeline data

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:

✓ Stop managing detections by hand in a SIEM console and start shipping them through a reviewed, tested pipeline
✓ Write detections once and deploy them to whichever SIEM your organization runs
✓ Build a test harness that catches a broken rule before your SOC does
✓ Answer "what ATT&CK coverage do we actually have" from your rule inventory, not a spreadsheet

What you'll learn

By the end of Detection as Code you will be able to:

✓ Author Sigma rules using the full specification: logsources, field taxonomy, modifiers, and correlation
✓ Structure a detection repository with the rule/test/documentation contract enforced by layout
✓ Convert a Sigma rule to KQL, SPL, and Elastic queries using sigma-cli and pySigma pipelines
✓ Build fixture-based tests that assert a rule fires on its true-positive events and stays silent on benign baseline
✓ Write a GitHub Actions workflow that gates every PR on lint, conversion, and test results
✓ Deploy a merged detection to a live Sentinel or Splunk instance without console interaction
✓ Recognize where Sigma stops and a detection legitimately stays native KQL or SPL, and version that native rule through the same pipeline
✓ Generate an ATT&CK coverage layer from your repo and measure rule health from pipeline data

Key course takeaways

✓ A detection-as-code pipeline you built in your own GitHub and keep after the course
✓ The engineering discipline to ship detections the way a software team ships code: reviewed, tested, deployed, and measured
✓ The judgment to decide when a detection stays in Sigma and when it escapes to native query language
✓ The metrics and operating model that keep a detection program healthy after the pipeline is running

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.

COURSE ASSESSMENT

End of Course Exam

Complete the course, then prove your skills under time pressure. Pass mark: 70. Earn your certificate with CPE credits.

40minutes
3phases
100points
1scenario
Take End of Course Exam

One random scenario per attempt. Certificate issued on pass.