A detection with no test data is a hope, not a control. And a rule set that grows for two years without regression testing quietly rots: rules overlap, duplicate, and drift until nobody knows what actually fires.
Tier: Advanced · Workflow area: Detection engineering with AI
This playbook uses AI for two linked jobs — generating known-good and known-bad test events for a rule, and running a regression pass across the rule set to find drift, duplication, and dead detections — with the hard rule that generated test data is validated against ground truth before it certifies anything.
Skip generation when you already have a real, labeled malicious sample — real data beats synthetic every time. Use AI to fill gaps, not to replace ground truth.
Generate test events matched to the rule's fields. Give the model the detection and ask for events that exercise the exact condition — both the case that must trigger and the near-miss that must not.
For this Sigma rule (pasted below), generate synthetic Sysmon EID 10 test
events (sample data, JSON):
- 3 TRUE POSITIVE events that should match the condition, varied so they do
not all look identical.
- 3 TRUE NEGATIVE events that are close but must NOT match (e.g. sanctioned
LSASS access, different GrantedAccess mask).
Use only real EID 10 fields. For each event, state in a comment WHY it should
or should not match, referencing the rule's condition.
Expected output: labeled positive/negative events, each annotated with why it lands on its side of the boundary. The annotations are what you check.
Validate the test data against the rule before trusting it. Run the compiled rule over the generated events. Every "true positive" event must match; every "true negative" must not. If a generated positive does not fire, either the event or your understanding of the rule is wrong — resolve it before this data certifies anything.
Cross-check near-misses against a real known-bad. Synthetic data can be too clean — it exercises the rule as written, not as attackers behave. Where you have even one real malicious sample (Atomic Red Team artifact), confirm the rule fires on it too, so you are not only testing the synthetic ideal.
Run the regression pass across the rule set. Ask the model to compare rules for overlap and drift, grounded in the rule bodies.
Here are N Sigma rules (pasted). Identify:
- Duplicate/near-duplicate rules (same behavior, cite the overlapping
conditions).
- Rules that are strict subsets of another (redundant coverage).
- Rules referencing fields/log sources we no longer collect (drift — I will
confirm against our schema).
For each finding cite the specific conditions. Do not merge or delete
anything; propose, and mark low-confidence findings.
Confirm every regression finding by hand. Overlap and subset claims are hypotheses. Open the cited conditions and verify before you retire or merge any rule — a "duplicate" may differ in one field that matters.
Synthetic test data proves a rule behaves as written, not that it catches real adversaries. Never certify a detection on generated events alone — anchor it to at least one real known-bad sample.
GrantedAccess mask that changes what they catch. Verify overlaps against data, not just text.Test-data generation is naturally client-safe because it produces synthetic events — but the rules you feed the model reveal the client's detection coverage. Run both the generation and the regression pass on a local Ollama model or the client's approved endpoint. Keep the rule set and all validation inside the client's environment; generated test events are synthetic and portable, but the real known-bad anchors and the retire/merge decisions belong to the client's detection owner. Ship the labeled test fixtures into the client's detection CI so every future rule change re-runs the same proven positive/negative cases.