Guardrails and AI Security
Input and output guardrails, prompt injection defences, PII protection, tool authorization, content safety services, red teaming and secure AI supply chains.
See the risk list in OWASP Top 10 for LLM Applications.
Guardrail layers
| Layer | Controls |
|---|---|
| Input | Prompt injection/jailbreak detection, PII detection and redaction, topic restrictions, length limits |
| Retrieval | Permission filters, source allowlists, content provenance, poisoning checks |
| Model | System instructions, low temperature for factual tasks, structured outputs |
| Tools | Allowlisted tools, scoped credentials, parameter validation, approvals for writes, rate limits |
| Output | Grounding/hallucination checks, toxicity and policy filters, PII redaction, safe rendering (no script injection) |
| Monitoring | Logging, anomaly detection, abuse reporting, incident response |
flowchart LR IN[User input] --> G1[Input guardrails] G1 -->|blocked| REF[Safe refusal] G1 --> APP[LLM application] APP --> G2[Tool policy enforcement] APP --> G3[Output guardrails] G3 -->|violation| FIX[Redact / regenerate / refuse] G3 --> OUT[Response]
Services and libraries
Amazon Bedrock Guardrails, Azure AI Content Safety (including Prompt Shields), Google Model Armor, NVIDIA NeMo Guardrails, Guardrails AI, Llama Guard / Prompt Guard models, Microsoft Presidio for PII.
Red teaming
Systematically attack the application: jailbreaks, direct and indirect injection (documents, web pages, emails), data exfiltration through tools, harmful content, bias probes. Use automated tools (PyRIT, garak, promptfoo red-team) plus human experts; turn findings into regression tests.
AI supply chain
Verify model sources and licences, scan model files (pickle risks), pin versions, document models (model cards), and track datasets used for fine-tuning.
Interview questions and answers
Are guardrail models enough to stop prompt injection?
No. They reduce risk but can be bypassed. The architecture must limit impact: least-privilege tools, authorization outside the model, approvals for risky actions, isolation of untrusted content, and monitoring.