Run it against labelled samples before it goes anywhere: inputs it must match, inputs it must not match, and hostile inputs built to evade or to slow it down. A rule that passes only the examples the model showed you has not been tested, only demonstrated.
Why these artifacts need care
A rule is code with a security job. If it is too narrow it misses attacks, and if it is too broad it floods analysts. OWASP's improper output handling guidance says to treat model output as untrusted and validate it before it reaches other systems, which includes detection logic headed for production.
The test set
Build three groups before you run anything.
| Group | Purpose | Example idea |
|---|---|---|
| Must match | Real attack samples, in each variant you know | Encoded and unencoded forms |
| Must not match | Normal traffic, common benign look-alikes | Legitimate admin tooling |
| Hostile | Inputs crafted to evade or stress | Odd casing, padding, very long strings |
Take samples from your own logs where you can, after redaction, so the test reflects reality.
Steps
- Read the rule and explain it in your own words. If you cannot, do not deploy it.
- Run it on the must match group and record misses.
- Run it on a day of real benign data and count matches. Each false match costs analyst time.
- Test performance with long inputs. Some regex patterns can take very long on crafted strings, which becomes a denial of service on your own pipeline.
- Check for assumptions: field names, log formats and timezones that differ in your environment.
- Deploy in alert only mode first, and watch it for a week.
- Add the test cases to version control next to the rule.
What the model often gets wrong
- Anchors and boundaries, which cause over or under matching
- Escaping of special characters
- Case handling and Unicode
- Field names from a different product version
- Treating one example as the whole pattern
Ownership
A named person owns each rule, with a review date. When a rule is retired, remove it, so the stale ones do not keep firing. Related: review an LLM written Sigma rule before you deploy it.
Where Safeguard fits
For code-level checks Safeguard offers SAST and dependency scanning with policies you control, so some patterns can be enforced by scanners rather than by hand-written regexes. Free scan: https://gold.safeguard.sh/scan.
Quick check
Is a rule safe if it matches the sample attack?
No. Also test benign data and evasive variants.
Should I deploy straight to blocking?
Start in alert only mode, measure, then decide.
Sources
- OWASP GenAI, LLM05:2025 Improper Output Handling: https://genai.owasp.org/llmrisk/llm052025-improper-output-handling/
Last reviewed: 19 October 2026.