Prompt injection cannot be solved with a prompt line
Microsoft, Google, OWASP and CrowdStrike point to layered defence against prompt injection: isolate untrusted content, validate output with code and limit rights.
You must now assume that some prompt injections will bypass your defences, and design your application so that those that do get through cause minimal harm. This means layered controls: isolating untrusted content, validating model output with deterministic code outside the model, limiting what the agent can authorise alone, and requiring human confirmation for irreversible actions.
The prompt is an analysis of 30 November 2026 of layered defence against prompt injection, which argues that the model prompt is not a security boundary and that injection cannot be solved by a single detector or sanitisation step. The analysis draws on guidance from Microsoft, Google, OWASP and CrowdStrike describing how indirect prompt injection—malicious instructions hidden in external content like emails, documents or tool output—exploits the fact that language models cannot distinguish instruction from data. In our assessment, this is the most significant operational shift for anyone deploying AI agents: the attack surface is not the model itself, but the workflow around it, and your controls must assume that some attacks will succeed.
Why a single detector cannot stop prompt injection
Indirect prompt injection works because the model processes everything in its context window as potentially actionable instruction. An attacker can hide malicious commands in any external source the agent touches: an email attachment, a document the agent retrieves, a web page it visits, or output from a tool it calls. The model cannot distinguish that hidden instruction from a legitimate user request and executes it as if the user had given it.
Current attack techniques go beyond simple keyword patterns. Attackers now use delayed or trigger-activated behaviour, fragmented payloads that only work when combined, special-token boundary manipulation, and instructions embedded in sources the organisation itself trusts. A probabilistic detector catches some of these attacks but never all of them. Because the model makes no architectural distinction between instruction and data, static keyword detection is inherently incomplete.
What controls must work together
- Isolation of untrusted content — separate external data from the model's core instructions so that injected commands cannot reach the agent's decision logic.
- Deterministic validation outside the model — use code, not prompts, to check model output against known-good patterns before the agent acts on it.
- Limited agent rights — restrict what the agent can authorise on its own; grant it only the minimum access needed for its intended function.
- Human confirmation for irreversible actions — require explicit approval before the agent can execute changes that cannot be undone.
- Adaptive red-team testing — run attacks in your actual deployed configuration, not in isolation, to find gaps that static testing misses.
Which concrete controls must you demonstrate
- Inventory every context source and tool the agent can reach — document each external system, database, email account or API the agent touches before deployment.
- Record in code which actions the agent may never authorise alone — anchor this boundary in application logic, not in a system prompt, so it cannot be overridden by injection.
- Validate model output with deterministic code — use rule-based checks outside the model to enforce constraints on what the agent can do next.
- Retain logs of blocked, approved and escalated actions — keep evidence of what the agent attempted, what you allowed and what you rejected, so incidents can be reconstructed.
- Run adaptive red-team tests in your deployed configuration — test with the actual model version, policy settings and context sources you use in production.
How to balance security with useful automation
The tension between security and convenience lies mainly in the confirmation step. Requiring human approval for every action slows down the agent and defeats much of its value. The solution is not less confirmation, but a sharp separation: the agent completes routine, reversible actions on its own; anything that changes state, deletes data or commits resources goes to a human first. This boundary must be written into the application code and tested regularly, not left to prompt engineering.
What tooling can and cannot do
Detection and sanitisation tools reduce the volume of suspicious content reaching the model, and they have a place in your stack. What they cannot do is guarantee that no injection gets through. Your responsibility is to assume that some will, and to design the application so that those injections cause no damage. Tooling can help you log, validate and enforce boundaries; it cannot replace the professional judgement needed to decide which actions your agent should ever be allowed to take alone. That decision belongs to your board, your legal team and your security leadership, and it must be recorded in writing before the application goes into production.
Sources: This article draws on reporting and guidance from Microsoft Learn, Google Workspace Help, OWASP Gen AI Security Project and CrowdStrike.
Written by
Tobias Lindqvist
Adversarial machine learning and the security properties of retrieval systems.