Detection-as-Code Is a Chain of Evidence
Detection-as-Code Is a Chain of Evidence
Use versioning, tests, provenance, staged deployment, and retirement to keep content trustworthy through change.
Approx. 4 min reading · Includes diagrams; allow extra time for reflection and linked resources.
Start reading ↓About this learning content and editorial review
Your focus
What you’ll learn
- Explain the reasoning developed in Detection-as-Code Is a Chain of Evidence without relying on product syntax.
- Distinguish observed evidence, analytical interpretation, assumptions, and limitations.
Use versioning, tests, provenance, staged deployment, and retirement to keep content trustworthy through change.
From reviewed source to the exact content running in production
Putting rules in a repository does not by itself create detection-as-code. Version control can show that a source file changed, but an operational program also needs to know which requirement the file implements, which dependencies shaped it, which artifact was deployed, and whether runtime still matches the approved state.
Think of the delivery path as a chain of evidence. A requirement explains the behavior and decision. Source content expresses logic and metadata. Validation checks structure and expected semantics. A build or conversion process produces a deployable artifact. Review authorizes the change. Deployment selects scope. Runtime health shows whether the artifact executes against the evidence it expects. Each link should be traceable to the next.
The repository therefore stores more than queries. Stable identifiers, owners, versions, data mappings, filters, lists, tests, runbooks, and change history make content operable. Dependencies need versions because a rule can behave differently when a shared parser, field map, model, or allowlist changes. Detection Dependencies and Content Packaging explains how a manifest and immutable artifact make the deployed unit explicit.
Provenance tells you how the artifact was produced. A signature can help verify that an approved pipeline created a particular digest, but it does not prove the logic is useful or safe. Review and testing establish different properties. Keeping those properties separate prevents “signed” from becoming a vague synonym for trusted.
Deployment should also create evidence. A canary release limits a candidate to representative scope while you compare matches, cost, latency, and analyst impact with promotion criteria defined in advance. Rollback requires the previous artifact and compatible dependencies, not merely a source commit. Runtime drift monitoring compares repository intent, deployed configuration, and actual execution. Canary Deployment and Rollback for Detection Content examines the tradeoffs.
Retirement completes the lifecycle. Low alert volume is not proof that a rule is unnecessary; it can indicate absent behavior, effective prevention, or silent failure. Before removing content, confirm health, identify consumers, compare replacement scope, preserve the stable identity for historical alerts, and record residual risk. The guidance in Detection Deprecation and Retirement treats removal as an evidence-based decision rather than repository cleanup.
Detection-as-code is valuable because it makes change reviewable and reversible. The code matters, but the deeper achievement is a continuous record of why the detection exists, what was tested, what was approved, what is running, and what the current evidence allows you to claim.
Resources
- Sigma Specification — Primary reference for the standards and concepts discussed in this lesson.