Skip to content

Detection Rule Lifecycle

github-actions[bot] edited this page Nov 29, 2026 · 1 revision

Last reviewed: 2026-11-28

Prerequisites: Detection Engineering index ยท Detection content validation.

๐ŸŽฏ Purpose

One lifecycle for Sigma, YARA/YARA-X, Suricata, Zeek and Wazuh content: author, review, test, deploy, tune and retire. It records how each engine identifies and versions a rule, so a change can be traced from the rule file to its test evidence.

โš™๏ธ Function

Gives the stage gates, the identifier and version fields per engine, and a peer-review checklist. Engine commands are linked to their canonical guides rather than repeated.

๐Ÿ† Goal

No rule reaches production without a stable ID, a version bump on change, a reviewer, and a fixture that proves both a match and a non-match.

๐Ÿ“‹ When To Use

  • Writing a new rule or importing one from upstream.
  • Changing the logic, level or log source of an existing rule.
  • Deciding whether to tune, replace or retire a rule.

๐Ÿชœ Stage Gates

Stage Exit criteria Evidence to keep
Author Behavior, required telemetry and minimum fields are written down (telemetry guide); the rule has an ID in an allocated range Rule file, linked issue or hypothesis
Review A second person checks logic, field names, ID, version and false-positive notes (checklist below) Review approval on the pull request
Test Positive, near-miss negative and malformed fixtures behave as expected in the real engine (testing guide) Expectation manifest and evidence manifest
Deploy The rule file loaded on the target is byte-identical to the reviewed file, and the engine accepted it Hash comparison and engine load or config-test output
Tune Every change has a measured reason and a regression fixture (tuning guide) Tuning record
Retire The replacement or reason is recorded; the ID is never reused Retirement note and, for Sigma, a related link

The deploy gate is modelled on the lab: it compares the SHA-256 of the Wazuh rule file inside the container with the committed file and records lab_rules_loaded_match.

๐Ÿ†” Identifiers & Versions Per Engine

Engine Identifier Version on change Source
Sigma id: a random UUID (version 4). Use a new id for major logic changes, derived rules kept active alongside the original, or merges modified date (YYYY-MM-DD) when the title, detection, level or log source changes, or status becomes deprecated Sigma rules specification 2.1.0
Suricata sid (greater than zero), with gid rev: "If a signature is modified, the number of rev will be incremented" Suricata 8.0.8 meta keywords
Wazuh <rule id>. Wazuh documents 100000-120000 for custom rules; test_wazuh_rule_contracts.py enforces 100000-119999 and uniqueness across the listed files No version field; track changes in Git and the rule description Wazuh custom rules (4.14)
YARA/YARA-X Rule identifier, unique within its namespace No built-in version; keep one in meta and in Git history YARA-X rule lab
Zeek Script path and, for alerts, the Notice::Type enum value (declared with redef enum Notice::Type += { ... }) No built-in version; track in Git or the package metadata you use Network detection

Allocated Ranges In This Repository

Engine Range Owner
Suricata 1007001-1007002 (inside the 1000000-1999999 local-use range recorded at sidallocation.org) Canary lab
Wazuh 100600-100609 (100601-100603 in use) Canary lab
Wazuh 100300-100354 and 100400-100423 Kismet, nzyme and honeypot rules

Pick a new block that does not overlap these, and add any new Wazuh rule file to FILES in test_wazuh_rule_contracts.py so its IDs and parents are checked. A built-in parent such as 86601 is accepted only if it is listed in that test's BUILTIN_PARENTS, with the upstream file it was verified in.

๐Ÿ”Ž Engine Notes

  • Sigma: status is one of stable, test, experimental, deprecated or unsupported. related types are derived, obsolete, merged, renamed and similar. Run sigma check --fail-on-issues; the default sigma check exits 0 even when it reports validation issues (observed with sigma-cli 4.0.1).
  • YARA-X: yr check <RULES_PATH> checks syntax and yr fmt --check <PATH> exits 1 if a file would be reformatted (both read from the v1.25.0 CLI source; not run in the lab). The lab compiles rules with the Python yara_x.compile() API, which raises CompileError.
  • Suricata: load only the rule file under test with -S, and run a configuration test with -T before deploying. Rule-writing guidance is in Network detection; offline replay is in Suricata + Zeek.
  • Zeek: zeek -a <script> exits after parsing, and zeek -C -r <pcap> <script> replays a capture while ignoring checksums (flags read from src/Options.cc at v9.0.1). Zeek is not covered by the canary lab, so Zeek rules stay at the static tier until a fixture run exists.
  • Wazuh: to change a built-in rule, copy it to a file under /var/ossec/etc/rules/ and add overwrite="yes". Wazuh ignores if_sid, if_group, if_level, if_matched_sid and if_matched_group in an overwrite rule and keeps the original values. Prefer a child rule with a new ID when you only need different behavior for a subset of events.

๐Ÿ‘€ Peer Review Checklist

  • The ID is new, in an allocated range, and not reused from a retired rule.
  • The version field (rev, modified) changed if the logic, level or log source changed.
  • Every field name exists in the ingested data, not only in the vendor schema. Check conversions with the field-mapping guide.
  • Anchors and match boundaries are deliberate, for example startswith/endswith in Suricata or ^...$ in Wazuh <field>.
  • Parent rules exist (if_sid in Wazuh) and the rule fires only where the parent fires.
  • A near-miss negative fixture exists and is one small change away from the positive.
  • Known false positives and the expected volume are written down.
  • The reviewer is not the author.

๐Ÿชฆ Retirement

  • Sigma: set status: deprecated and update modified. The replacement rule lists the old ID under related with type obsolete.
  • Suricata: remove or disable the signature, and keep its sid recorded as retired so it is not reallocated.
  • Wazuh: check for children first. Any rule with if_sid or if_matched_sid pointing at the retired ID stops working; the contract test fails when a listed parent is missing.
  • All engines: remove or update the fixtures and expectation manifest entries in the same change, and say in the tuning record why the rule was retired.

See also

Related Files


โฌ…๏ธ Detection Engineering index | Master Index | ๐ŸŽฏ Role Navigation | Legal Notice


๐Ÿ“„ Source: IncidentResponse/DetectionEngineering/rule-lifecycle.md | โœ๏ธ Suggest an edit | โฌ…๏ธ Back to Incident Response

Clone this wiki locally