Study FAQ
How do I defend a Claude application against prompt injection with layered guardrails?
Also asked as 2
- What safeguards should surround Claude when documents or tools return untrusted content?
- How do I limit prompt-injection impact beyond labeling external input?
Answer
Treat user input and external content as untrusted, and limit what the model can access or cause even if it follows an embedded instruction. Authenticate and authorize the task, minimize data and visible tools, label sources in the request, and validate proposed outputs and effects in application code. For indirect injection, keep external tool data in tool_result blocks and use the documented isolation pattern. Mitigate jailbreaks and prompt injections Handle tool calls
For example, a support workflow reading an uploaded letter should see only the records needed for the current task. It can classify the letter without a sending tool. If the workflow has a sending step, resolve and authorize the destination and require approval according to policy. Delimiters help communicate the input boundary to Claude. Tool visibility, deterministic checks, scoped credentials, and execution limits control the effects. Mitigate jailbreaks and prompt injections Building effective agents
Check response completeness, structure, domain meaning, and output destination. Keep high-impact actions behind the appropriate review and run representative adversarial and denied-path tests in an isolated environment. Audit security decisions and resulting effects with minimized evidence. Mitigate jailbreaks and prompt injections Claude Code security
Full explanation
Securing Claude Applications with Guardrails, Hooks, and Secret Management
Study guide · CCDV-F
Read the full explanation