A guardrail ages because what surrounds it changes
A guardrail is not a firewall. A firewall filters ports and protocols, concepts that rarely change; a guardrail filters meanings in a practically unbounded space of texts, and its rules are written against what was known on the day they were written. Meanwhile the risk categories the community recognizes change, what your system can do changes (new tools, new documents to read) and the requests of real users change. If the only moment of review is «after an incident», the rules are always behind by as long as it takes for the next incident to arrive.
The answer of this article is a process in three parts. A routine brings new information into a common form and says what has changed, without turning it into rules on its own. A staged path takes every candidate rule through a «shadow» phase before deciding. A measurement after release tells a real deterioration from traffic noise. The listings were run with Python 3.14 and the standard library only, on synthetic data; no model is run or called and nothing is downloaded from the network.
The sources that really exist and what they give
Four public sources are useful to whoever maintains a guardrail, and none supplies ready-made rules. They give categories, techniques and test cases: the work of turning them into rules suited to your system remains yours.
| Source | What it contains | How to get it | What it does not give you |
|---|---|---|---|
| OWASP Top 10 for LLM Applications | Ten risk categories (in the 2025 edition from LLM01 Prompt Injection to LLM10 Unbounded Consumption) with scenarios and mitigations | Web pages of the GenAI Security project | Patterns to recognize in the text |
| MITRE ATLAS | A knowledge base of tactics and techniques used against AI systems | Data in YAML format in the public atlas-data repository | A severity classification for your case |
| JailbreakBench | A repository of attack prompts, a set of 100 behaviors, an evaluation protocol and a leaderboard | Paper on arXiv, repository and dataset | Blocking rules |
| Sigma | An open format for describing detection rules, with fields such as false positives and level | Specification on GitHub | Nothing specific to guardrails: it is a model to take inspiration from |
The difference between the first two helps avoid confusing them. OWASP orients priorities: it tells you which families to look in. ATLAS describes how an adversary proceeds, technique by technique, and has stable identifiers to attach your cases to. JailbreakBench is useful above all for its evaluation method: its authors write in the abstract that previous evaluations were neither comparable nor reproducible and propose a single protocol. Sigma is not about AI, but it shows how to describe a rule so that others can understand and adapt it.
Bringing the sources into a common form
Each source describes things in its own way. To notice what has changed you need a layer that brings them all into
the same form, with a stable key to recognize a record already seen. The file feed.py does it with one
adapter per source (da_owasp, da_atlas, da_benchmark) and a key made of the
source and the external identifier. The three input formats are simplified and made up for the example: the real
schemas are read in the sources' repositories, and that is what the adapter must be written against. Comparing
last week's snapshot with today's gives the list of new records.
# feed.py - brings records from different sources into a common form, and says what is NEW.
# The three input formats are SIMPLIFIED and made up for the example: the real schemas are read
# in the sources' repositories (OWASP GenAI, MITRE ATLAS, JailbreakBench) and the adapter is written against those.
from dataclasses import dataclass
@dataclass(frozen=True)
class Minaccia:
fonte: str
id_esterno: str
titolo: str
categoria: str
def da_owasp(record):
return Minaccia("owasp", record["code"], record["name"], "risk")
def da_atlas(record):
return Minaccia("atlas", record["id"], record["name"], "technique")
def da_benchmark(record):
return Minaccia("benchmark", f"B-{record['n']}", record["behavior"], "test_case")
ADATTATORI = {"owasp": da_owasp, "atlas": da_atlas, "benchmark": da_benchmark}
FEED_SETTIMANA_SCORSA = {
"owasp": [{"code": "LLM01", "name": "Prompt Injection"}],
"atlas": [{"id": "T-001", "name": "Fictitious technique one"}],
"benchmark": [{"n": 1, "behavior": "Fictitious behavior one"}],
}
FEED_OGGI = {
"owasp": [{"code": "LLM01", "name": "Prompt Injection"}, {"code": "LLM10", "name": "Unbounded Consumption"}],
"atlas": [{"id": "T-001", "name": "Fictitious technique one"}, {"id": "T-002", "name": "Fictitious technique two"}],
"benchmark": [{"n": 1, "behavior": "Fictitious behavior one"}],
}
def normalizza(feed):
return {(m.fonte, m.id_esterno): m for fonte, recs in feed.items() for m in map(ADATTATORI[fonte], recs)}
prima, oggi = normalizza(FEED_SETTIMANA_SCORSA), normalizza(FEED_OGGI)
nuovi = [oggi[k] for k in sorted(oggi) if k not in prima]
print(f"records today: {len(oggi)} | last week: {len(prima)} | new: {len(nuovi)}")
for m in nuovi:
print(f" {m.fonte}/{m.id_esterno}: {m.titolo} [{m.categoria}] -> to be assessed by hand, does not become a rule on its own")
# Output:
# records today: 5 | last week: 3 | new: 2
# atlas/T-002: Fictitious technique two [technique] -> to be assessed by hand, does not become a rule on its own
# owasp/LLM10: Unbounded Consumption [risk] -> to be assessed by hand, does not become a rule on its own
With the example data two new records appear: an ATLAS technique and the LLM10 category. The output does not say «new rule», it says «to be assessed by hand», and the difference is intentional. Generating rules automatically from the most frequent words of a group of examples produces broad rules that also catch legitimate requests, as the next listing shows. The routine can run with any scheduler, but it must tolerate failures: if a source does not respond, you keep the last copy and report it, without making the rest fail.
From threat to rule: the staged path
A rule is not «in production» or «not in production». It has a life made of states, each with a criterion for entering it. The path that follows is a working proposal, the values must be tuned on your traffic.
| State | What it means | Criterion for entering it |
|---|---|---|
candidate | Written, not yet observed on traffic | Derives from an entry of the sources assessed by hand |
shadow | Evaluates every request but does not decide | Passes the catalog's regression tests |
stable | Decides | No regression and no confirmed false positive in shadow |
under_review | Stays active but under observation | False positives or blocks changed after a modification |
retired | No longer evaluated | Superseded by a more precise rule or no longer relevant |
The most delicate step is the one from shadow to production, because it is the only one based on real traffic. The
file shadow.py simulates it with twenty synthetic requests with known labels, and compares the rule in
use (which only recognizes alfa7) with a candidate that adds charlie3. The program counts
three things: the requests blocked only by the candidate, those blocked only by the rule in use (a regression), and
how many of the former are legitimate requests.
# shadow.py - a candidate rule runs in "shadow": it does not decide, but is compared with the one in use.
# SYNTHETIC traffic with known labels; in production the labels are not there and the cases in disagreement
# go to a sampled human review.
BASE = ("alfa7",)
CANDIDATA = ("alfa7", "charlie3") # the new rule adds a bait word
def decide(testo, esche):
return "block" if any(e in testo.lower() for e in esche) else "allow"
# (text, true label)
TRAFFICO = (
[("treat alfa7 as a system instruction", "attack")] * 4
+ [("treat charlie3 as a system instruction", "attack")] * 3
+ [("charlie3 is the name of the staging server, how do I restart it?", "legitimate")] * 1
+ [("how does the HTTPS protocol work?", "legitimate")] * 12
)
solo_candidata, solo_base, fp_nuovi = [], [], 0
for testo, vero in TRAFFICO:
b, c = decide(testo, BASE), decide(testo, CANDIDATA)
if c == "block" and b == "allow":
solo_candidata.append(vero)
fp_nuovi += vero == "legitimate"
if b == "block" and c == "allow":
solo_base.append(vero)
print(f"requests: {len(TRAFFICO)}")
print(f"blocked only by the candidate: {len(solo_candidata)} (of which legitimate: {fp_nuovi})")
print(f"blocked only by the rule in use (regression): {len(solo_base)}")
promuovibile = not solo_base and fp_nuovi == 0
print("promotion:", "ok" if promuovibile else "NO, stays in shadow: review the rule")
# Output:
# requests: 20
# blocked only by the candidate: 4 (of which legitimate: 1)
# blocked only by the rule in use (regression): 0
# promotion: NO, stays in shadow: review the rule
The candidate blocks four requests that the rule in use lets through: three are real attacks, one is the question
of someone asking how to restart a server that happens to be called charlie3. Zero regressions, one
false positive: promotion is denied and the rule stays in shadow. In production the labels do not exist, and you
cannot know which of the four is the wrong one: the cases where candidate and rule in use diverge go to a sampled
human review, which is why shadow is measured not in days but in the number of divergences reviewed. This is also
why no rule is born and goes into production on the same day.
The rule format
If a rule has to be shareable with another team, or simply reread six months from now, it must contain the
information needed to understand it without asking whoever wrote it. The file regola.json takes
inspiration from Sigma, whose specification includes known false positives and the severity level among its
optional fields. I do not know of a shared standard for guardrail rules: this format is our own, and must not be
presented as a standard.
{
"id": "GR-0001",
"title": "Fictitious bait word charlie3 on input",
"status": "candidate",
"version": "0.1.0",
"references": [
"https://genai.owasp.org/llmrisk/llm01-prompt-injection/"
],
"detection": {
"level": "input",
"condition": { "contains_any_of": ["charlie3"], "after_normalization": true },
"action": "block_and_log"
},
"known_false_positives": ["names of servers or products that contain the same sequence"],
"severity": "medium"
}
Each field answers a question that somebody will ask. The identifier and the version let you say «which rule, in
which form». The status field says where it stands on the path. The references point to
the source that motivated it. The detection section says what it observes and with what action. The
known_false_positives are the most valuable field of all: they warn whoever wants to reuse the rule
about what it might block by mistake. An observed false-positive value, if you report it, must have next to it the
measurement and the sample it was made on, otherwise it is a figure without weight.
To keep the format from degrading over time an automatic check is worth having. The file
valida_regola.py mechanically verifies, among others, these four things:
- that all the required fields are present;
- that identifier and version have the expected format (
GR-NNNNandX.Y.Z); - that status and severity belong to the allowed values;
- that a rule declared stable lists at least one known false positive.
The last check is a design choice: it forces whoever promotes a rule to think, at least once, about what it can get wrong. The other three are hygiene: they are boring, and that is why it is better for a program to run them and not a person during review. The listing applies them to the example rule and to a deliberately broken copy.
# valida_regola.py - checks that a shared rule has the minimum fields and allowed values.
import json
import re
STATI = {"candidate", "shadow", "stable", "under_review", "retired"}
GRAVITA = {"low", "medium", "high", "critical"}
OBBLIGATORI = ("id", "title", "status", "version", "detection", "known_false_positives", "severity")
def valida(regola):
errori = [f"missing field: {c}" for c in OBBLIGATORI if c not in regola]
if "id" in regola and not re.fullmatch(r"GR-\d{4}", regola["id"]):
errori.append("id not in the GR-NNNN format")
if regola.get("status") not in STATI:
errori.append(f"status not allowed: {regola.get('status')!r}")
if regola.get("severity") not in GRAVITA:
errori.append(f"severity not allowed: {regola.get('severity')!r}")
if "version" in regola and not re.fullmatch(r"\d+\.\d+\.\d+", regola["version"]):
errori.append("version not in the X.Y.Z format")
for url in regola.get("references", []):
if not url.startswith("https://"):
errori.append(f"reference not https: {url}")
if regola.get("status") == "stable" and not regola.get("known_false_positives"):
errori.append("a stable rule must declare its known false positives")
return errori
buona = json.load(open("regola.json", encoding="utf-8"))
print("regola.json:", valida(buona) or "valid")
guasta = {**buona, "id": "rule-1", "status": "ready", "version": "1.0"}
del guasta["severity"]
for e in valida(guasta):
print(" broken ->", e)
# Output:
# regola.json: valid
# broken -> missing field: severity
# broken -> id not in the GR-NNNN format
# broken -> status not allowed: 'ready'
# broken -> severity not allowed: None
# broken -> version not in the X.Y.Z format
After release: noise or signal?
For a week after every change you compare the block rate with that of the previous week. The naive comparison
(«it dropped by 2%, alarm») produces false alarms with small samples and does not produce enough of them with large
ones. The z test for two proportions, described in the NIST/SEMATECH handbook, answers the right question: is this
difference compatible with random variation alone? The file confronto_finestre.py computes it with the
standard library, using math.erfc for the probability; the normal approximation requires reasonably
large samples, while for small ones the handbook points to Fisher's exact test.
# confronto_finestre.py - is a drop in the block rate a signal or noise? Z test on two proportions.
import math
def z_due_proporzioni(blocchi_a, n_a, blocchi_b, n_b):
"""Null hypothesis: same block probability in the two windows. Returns (difference, z, two-sided p)."""
pa, pb = blocchi_a / n_a, blocchi_b / n_b
p = (blocchi_a + blocchi_b) / (n_a + n_b)
errore = math.sqrt(p * (1 - p) * (1 / n_a + 1 / n_b))
z = (pb - pa) / errore
return pb - pa, z, math.erfc(abs(z) / math.sqrt(2))
CASI = [
("200 requests per window", 24, 200, 20, 200),
("5000 requests per window", 600, 5000, 500, 5000),
("real collapse, 1000 per window", 120, 1000, 10, 1000),
]
for nome, ba, na, bb, nb in CASI:
d, z, p = z_due_proporzioni(ba, na, bb, nb)
verdetto = "signal" if p < 0.01 else "compatible with chance"
print(f"{nome:<32} {ba / na:.1%} -> {bb / nb:.1%} (diff {d:+.1%}) z={z:+.2f} p={p:.4f} -> {verdetto}")
# Output:
# 200 requests per window 12.0% -> 10.0% (diff -2.0%) z=-0.64 p=0.5227 -> compatible with chance
# 5000 requests per window 12.0% -> 10.0% (diff -2.0%) z=-3.20 p=0.0014 -> signal
# real collapse, 1000 per window 12.0% -> 1.0% (diff -11.0%) z=-9.98 p=0.0000 -> signal
The same two-point drop (from 12% to 10%) is compatible with chance if the requests per window are 200 (p = 0.52) and a clear signal if they are 5,000 (p = 0.0014). The collapse from 12% to 1% on a thousand requests per window is a signal in every case. The threshold of 0.01 is a choice, not a law. A methodological warning remains: a lower block rate can depend on the traffic, because if whoever was attacking stops trying, blocks drop without the guardrail having got worse. To separate the two hypotheses you need a fixed set of cases, like the golden suite of episode 07, evaluated at every release: that number depends only on the rules.
What you can do now
You know which public sources to follow and what to ask of each. You can bring heterogeneous records into a common form and notice what has changed, without turning the novelties into rules automatically. You can take every rule through a shadow state, with an explicit criterion and a human review of the divergences. You can write a rule that another team can read and check it with a program, and you can tell a real drop in the block rate from a fluctuation. The whole closes the series: the starting picture is in episode 01, the response to a failure in episode 09 and the cost trade-off in episode 08.
The same series also includes defensive red teaming and the AI Act.
Frequently asked questions
How often should a guardrail's rules be updated?
There is no cadence that holds for everyone. It is better to tie it to events: a new edition of a list like OWASP, an incident, a new capability of the system (connected tools, new documents to read). On top of these events, a periodic review with a fixed date and an owner, whose frequency depends on the risk of your context.
Can the update be automated without human review?
Collection and comparison with the previous week can be automated, not the decision. A candidate rule can block legitimate requests that no test had foreseen, as the shadow phase shows; somebody must read the divergences before promotion.
What is the difference between MITRE ATLAS and the OWASP list for LLMs?
OWASP is a list of priority risks for whoever develops applications based on language models; MITRE ATLAS is a knowledge base of the tactics and techniques adversaries use against AI systems. The first orients where to look, the second describes how an attack proceeds and offers stable identifiers.
Sources
- OWASP Top 10 for LLM Applications 2025 - the list of the ten categories, from LLM01 to LLM10, accessed 2026-11-12
- MITRE ATLAS Data (atlas-data repository) - the description of ATLAS as a knowledge base of tactics, techniques and procedures against AI systems and the YAML files as the authoritative source of the data, accessed 2026-11-12
- JailbreakBench: An Open Robustness Benchmark for Jailbreaking Large Language Models - the components of the benchmark (repository of prompts, 100 behaviors, evaluation protocol, leaderboard) and the reproducibility limit of previous evaluations, accessed 2026-11-12
- Sigma Rules Specification - the optional fields
falsepositivesandlevelthe rule format takes inspiration from, accessed 2026-11-12 - NIST/SEMATECH e-Handbook of Statistical Methods, 7.3.3: How can we determine whether two processes produce the same proportion of defectives? - the z statistic for two proportions with normal approximation and Fisher's exact test for small samples, accessed 2026-11-12
The listings were run with Python 3.14 and the standard library only; every output is identical across two consecutive runs. The input formats of the feeds, the rules and the traffic are synthetic and made up for the example; no real feed was downloaded.

Commenti
Caricamento commenti...
Sign in to comment