GuidesSecurity
Prompt injection: what a sandbox can and can't stop
Prompt injection is text hidden in a web page, email or file that hijacks an agent. A sandbox limits what a hijacked agent can break or reach. It does nothing to stop the hijack, so the useful question is what you let the agent combine.
Short answer: No. A sandbox limits the damage a tricked agent can do; it does not stop it being tricked, and OWASP says "it is unclear if there are fool-proof methods of prevention for prompt injection". The practical defence is to avoid giving one agent your private data, untrusted content and a way to send data out at the same time.
What prompt injection is
OWASP, which keeps the standard list of risks for AI applications, defines it as prompts that "alter the LLM's behavior or output in unintended ways" (4). The kind that matters for agents is indirect: it "occur[s] when an LLM accepts input from external sources, such as websites or files" (5). Anthropic describes the same case: the user is trusted, but the model "processes third-party content (webpages, emails, documents, tool results) that contains adversarial instructions" (6).
No vendor claims to have solved it. Anthropic: "no system is completely immune to all attacks" (7). Codex's docs: "Prompt injection can cause the agent to fetch and follow untrusted instructions" (8).
The combination to avoid
Simon Willison's "lethal trifecta" is the clearest test. An agent is at risk when it has "Access to your private data", "Exposure to untrusted content" and "The ability to externally communicate in a way that could be used to steal your data" (2). "If your agent combines these three features, an attacker can easily trick it into accessing your private data and sending it to that attacker" (9), and his conclusion is that "The only way to stay safe there is to avoid that lethal trifecta combination entirely" (3).
Most useful agents have all three: a personal assistant that reads your email, browses the web and can send messages is the textbook case.
What a sandbox does, and what it doesn't
It limits the blast radius. OpenAI uses sandboxing "to prevent the model from making harmful changes that might be the result of a prompt injection" (10), and Anthropic says isolation "reduces the impact of a breach, but it does not eliminate risk" (11).
It does not stop data leaving through any route you leave open: "Any approach that allows network egress can still leak data the agent can read" (12). It does not change what the model sees, because "Isolation also does not change what is sent to the model" (13). And filters can have gaps: Codex's network proxy does not cover "web search, app or connector tool calls, MCP server connections, browser or Computer Use activity" (14).
What actually helps
Give it less. OWASP's advice is to "Restrict the model's access privileges to the minimum necessary" (15), and it lists "excessive functionality; excessive permissions; excessive autonomy" as the root causes of damage (16). OpenAI says the same: "limit an agent's access to only the sensitive data or credentials it needs to complete the task" (17).
Break the trifecta on purpose. Turn the internet off for jobs that do not need it (Turn the internet off), allow only named sites for those that do (Allow only some sites), and keep keys where the agent cannot read them (Secrets the agent cannot read). These are machine settings, so they hold even when the model is fooled.
Keep a human on the risky steps. OWASP recommends "human-in-the-loop controls for privileged operations" (18), and OpenAI's design goal is that dangerous actions or transmissions of sensitive information "should not happen silently or without appropriate safeguards" (19). If you write your own agent, Anthropic's advice is to "Put untrusted content only in tool results" (20), so the model can tell instructions from data.
Which providers help
From the capability checks; each links to every provider's verdict and its catch
| Capability | Yes | With a catch |
|---|---|---|
| Turn the internet off Run a machine with no internet access at all. | Yes Agent 37, Cloudflare Sandbox, Daytona, DigitalOcean, E2B, Modal, Runtime, Tensorlake, Vercel Sandbox, boxd | With a catch Boat, Sandboxer, Sprites |
| Allow only some sites Limit which internet addresses the machine can reach. | Yes Agent 37, Cloudflare Sandbox, Daytona, DigitalOcean, E2B, Modal, Runtime, Sprites, Tensorlake, Vercel Sandbox, boxd | With a catch Blaxel, Boat |
| Secrets the agent cannot read Keys are added to outgoing requests by the provider, so the agent never sees them. | Yes Cloudflare Sandbox, Daytona, E2B, InstaBox, Runtime, Vercel Sandbox, boxd | With a catch Blaxel, Boat, DigitalOcean, Modal, Sprites |
| Its own virtual machine Each sandbox is a separate virtual machine (microVM or full VM), not a container sharing a kernel with neighbours. | Yes Blaxel, Boat, Cloudflare Sandbox, DigitalOcean, E2B, InstaBox, Lizard, Morph, Runtime, Sandboxer, Sprites, Vercel Sandbox, boxd | With a catch Agent 37, Daytona, Modal, Tensorlake |
Sources
Each quote was read on the page linked, on the date shown
- OWASP Top 10 for LLM Applications: LLM01 Prompt Injection (genai.owasp.org, 29 October 2026) third-party
“it is unclear if there are fool-proof methods of prevention for prompt injection”
- Simon Willison: The lethal trifecta for AI agents (simonwillison.net, 29 October 2026) third-party
“Access to your private data —one of the most common purposes of tools in the first place! Exposure to untrusted content —any mechanism by which text (or images) controlled by a malicious attacker could become available to your LLM The ability to externally communicate in a way that could be used to steal your data”
- Simon Willison: The lethal trifecta for AI agents (simonwillison.net, 29 October 2026) third-party
“The only way to stay safe there is to avoid that lethal trifecta combination entirely.”
- OWASP Top 10 for LLM Applications: LLM01 Prompt Injection (genai.owasp.org, 29 October 2026) third-party
“A Prompt Injection Vulnerability occurs when user prompts alter the LLM’s behavior or output in unintended ways.”
- OWASP Top 10 for LLM Applications: LLM01 Prompt Injection (genai.owasp.org, 29 October 2026) third-party
“Indirect prompt injections occur when an LLM accepts input from external sources, such as websites or files.”
- Claude API docs: mitigate jailbreaks and prompt injections (platform.claude.com, 29 October 2026) docs-confirmed
“where the user is trusted but Claude processes third-party content (webpages, emails, documents, tool results) that contains adversarial instructions”
- Claude Code docs: security (code.claude.com, 29 October 2026) docs-confirmed
“While these protections significantly reduce risk, no system is completely immune to all attacks.”
- OpenAI Codex docs: approvals and security (learn.chatgpt.com, 29 October 2026) docs-confirmed
“Prompt injection can cause the agent to fetch and follow untrusted instructions.”
- Simon Willison: The lethal trifecta for AI agents (simonwillison.net, 29 October 2026) third-party
“If your agent combines these three features, an attacker can easily trick it into accessing your private data and sending it to that attacker.”
- OpenAI: Understanding prompt injections (openai.com, 29 October 2026) docs-confirmed
“we use a technique called sandboxing to prevent the model from making harmful changes that might be the result of a prompt injection”
- Claude Code docs: sandbox environments (code.claude.com, 29 October 2026) docs-confirmed
“Sandbox isolation reduces the impact of a breach, but it does not eliminate risk.”
- Claude Code docs: sandbox environments (code.claude.com, 29 October 2026) docs-confirmed
“Any approach that allows network egress can still leak data the agent can read, and any approach that mounts your project directory writable can still modify that code.”
- Claude Code docs: sandbox environments (code.claude.com, 29 October 2026) docs-confirmed
“Isolation also does not change what is sent to the model.”
- OpenAI Codex docs: approvals and security (learn.chatgpt.com, 29 October 2026) docs-confirmed
“The network proxy filters scripts, programs, and child processes that run inside the local command sandbox. It does not filter web search, app or connector tool calls, MCP server connections, browser or Computer Use activity, Codex cloud tasks, or the client's model and authentication requests.”
- OWASP Top 10 for LLM Applications: LLM01 Prompt Injection (genai.owasp.org, 29 October 2026) third-party
“Restrict the model’s access privileges to the minimum necessary for its intended operations.”
- OWASP Top 10 for LLM Applications: LLM06 Excessive Agency (genai.owasp.org, 29 October 2026) third-party
“excessive functionality; excessive permissions; excessive autonomy.”
- OpenAI: Understanding prompt injections (openai.com, 29 October 2026) docs-confirmed
“Where possible, limit an agent’s access to only the sensitive data or credentials it needs to complete the task.”
- OWASP Top 10 for LLM Applications: LLM01 Prompt Injection (genai.owasp.org, 29 October 2026) third-party
“Implement human-in-the-loop controls for privileged operations to prevent unauthorized actions.”
- OpenAI: Designing AI agents to resist prompt injection (openai.com, 29 October 2026) docs-confirmed
“potentially dangerous actions, or transmissions of potentially sensitive information, should not happen silently or without appropriate safeguards.”
- Claude API docs: mitigate jailbreaks and prompt injections (platform.claude.com, 29 October 2026) docs-confirmed
“Put untrusted content only in tool results.”