Glossary
Guardrail
A control layer around an LLM that inspects and constrains inputs and outputs to enforce safety, policy, and security boundaries.
What it is
A guardrail is a control that sits around an LLM to keep its inputs and outputs within acceptable bounds. Guardrails can be input-side (detecting injection attempts, off-topic requests, or PII before they reach the model), output-side (blocking unsafe content, secrets, or malformed responses before they reach the user), or action-side (gating which tools and parameters the model is allowed to invoke). They are typically implemented with classifiers, regex and policy rules, allow/deny lists, or a secondary "judge" model.
Why it matters for LLM security
Because model alignment alone can be defeated by jailbreaks and prompt injection, guardrails provide an independent, deterministic enforcement layer that does not depend on the model behaving correctly. They are a core mitigation recommended for OWASP LLM01: Prompt Injection and are central to defense-in-depth: even when one layer fails, another can catch the abuse.
Defense pointer
Deploy guardrails as a layered, independent control — never the sole defense — and continuously test them against evolving injection and jailbreak techniques so coverage does not drift.