<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kosa8</title>
    <description>The latest articles on DEV Community by kosa8 (@drew_60e8126e2de2f177050e).</description>
    <link>https://dev.to/drew_60e8126e2de2f177050e</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3952390%2F91ef59df-c48e-4a3c-ad2f-165fc85071d1.png</url>
      <title>DEV Community: kosa8</title>
      <link>https://dev.to/drew_60e8126e2de2f177050e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/drew_60e8126e2de2f177050e"/>
    <language>en</language>
    <item>
      <title>How to safely run untrusted code generated by LLMs</title>
      <dc:creator>kosa8</dc:creator>
      <pubDate>Mon, 30 Nov 2026 15:17:04 +0000</pubDate>
      <link>https://dev.to/drew_60e8126e2de2f177050e/how-to-safely-run-untrusted-code-generated-by-llms-6bf</link>
      <guid>https://dev.to/drew_60e8126e2de2f177050e/how-to-safely-run-untrusted-code-generated-by-llms-6bf</guid>
      <description>&lt;p&gt;Treat code an LLM wrote as code from an unknown author. Run it in a fresh, disposable environment behind a kernel boundary it does not share with your host (a microVM, or at minimum a user-space kernel such as gVisor), with no credentials inside, a network closed except for hosts you list and enforced outside the sandbox, hard limits on CPU, memory, disk, processes and time, and a record of what it did. Reviewing or filtering the code helps, but only the runtime boundary limits what the code can reach once it runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why LLM-generated code counts as untrusted
&lt;/h2&gt;

&lt;p&gt;Three things make generated code untrusted even when the model is well behaved. It can be &lt;strong&gt;wrong&lt;/strong&gt;: a cleanup script that deletes the wrong directory, a loop that never ends, a migration that drops a table. It can be &lt;strong&gt;steered&lt;/strong&gt;: a prompt injection in a web page, an issue, a README, an email or a tool description can make the model write code that serves whoever planted it. And it pulls in &lt;strong&gt;code nobody chose&lt;/strong&gt;: models suggest packages, and some of the names they suggest do not exist until an attacker registers them, a pattern researchers call package hallucination.&lt;/p&gt;

&lt;p&gt;OWASP's Top 10 for LLM Applications 2025 names the two failures behind most of the damage. &lt;strong&gt;Improper Output Handling&lt;/strong&gt; (LLM05) is passing model output to a shell or interpreter without controls. &lt;strong&gt;Excessive Agency&lt;/strong&gt; (LLM06) is giving a model more tools and permissions than its task needs. The fix for both is the same: decide what the code can reach before it runs, and enforce that somewhere the code cannot change.&lt;/p&gt;

&lt;p&gt;Untrusted code tends to try the same things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;read credentials from environment variables, dotfiles, SSH agents and cloud metadata endpoints;&lt;/li&gt;
&lt;li&gt;send data to any host it can reach, including over DNS;&lt;/li&gt;
&lt;li&gt;install packages and run their install scripts;&lt;/li&gt;
&lt;li&gt;write outside its working folder, or change files you will run later;&lt;/li&gt;
&lt;li&gt;use all the CPU, memory, disk or process slots on the machine;&lt;/li&gt;
&lt;li&gt;leave something behind for the next run: a file, a cron entry, a background process.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The checklist
&lt;/h2&gt;

&lt;p&gt;Each control covers a failure of the others.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use a boundary that does not share your host's kernel.&lt;/strong&gt; For code nobody has reviewed, use a microVM (Firecracker, Cloud Hypervisor or Kata Containers on Linux with KVM, or Apple's Virtualization framework on a Mac) or, at minimum, a user-space kernel such as gVisor. A plain container is a floor for reviewed code, not a boundary for hostile code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Never run it in your application's process.&lt;/strong&gt; No &lt;code&gt;exec()&lt;/code&gt;, &lt;code&gt;eval()&lt;/code&gt; or subprocess call on the server that holds your database credentials, even for a quick calculation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Put no secrets inside.&lt;/strong&gt; No API keys in environment variables, no mounted home directory, no SSH agent, no cloud credentials, and never the container runtime's socket. If the code must call an API, add the credential outside the sandbox on the way out, or hand it a short-lived token scoped to that one task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Close the network, then open only what the task needs.&lt;/strong&gt; Deny by default and allow named hosts, such as one package index or one API. Enforce the rule outside the sandbox, answer DNS only for allowed names, and block link-local and cloud metadata addresses such as &lt;code&gt;169.254.169.254&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cap resources and time.&lt;/strong&gt; Set CPU, memory, disk and process-count limits and a wall-clock timeout for every run. Cap the size of stdout and stderr too, because that output flows back into the model's context.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Start every run from a known state.&lt;/strong&gt; Use a fresh sandbox per run, or restore a clean snapshot before each run. Never reuse one environment across users or tenants.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mount the minimum, read-only by default.&lt;/strong&gt; Copy input files in, or mount one folder read-only, and collect results from one known output path.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Record what happened.&lt;/strong&gt; Keep commands, exit codes, network attempts (allowed and refused) and outputs, written by something outside the sandbox so the code cannot edit its own record.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Which isolation boundary to use
&lt;/h2&gt;

&lt;p&gt;The boundary decides what a bug in the code, or in the layer under it, can reach. The table runs from weakest to strongest.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Technology&lt;/th&gt;
&lt;th&gt;What handles the code's system calls&lt;/th&gt;
&lt;th&gt;Shares the host kernel?&lt;/th&gt;
&lt;th&gt;Start-up&lt;/th&gt;
&lt;th&gt;Good fit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Language-level sandbox (restricted interpreter, AST filters)&lt;/td&gt;
&lt;td&gt;Your own process&lt;/td&gt;
&lt;td&gt;Yes, and your process memory&lt;/td&gt;
&lt;td&gt;Instant&lt;/td&gt;
&lt;td&gt;Not a security boundary on its own&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OS process sandbox (seccomp, Landlock, macOS Seatbelt)&lt;/td&gt;
&lt;td&gt;The host kernel, behind a filter&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Instant&lt;/td&gt;
&lt;td&gt;Narrowing a trusted tool's file and network access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Container (runc)&lt;/td&gt;
&lt;td&gt;The host kernel&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Lowest&lt;/td&gt;
&lt;td&gt;Reviewed code on a patched host&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Container under gVisor (runsc)&lt;/td&gt;
&lt;td&gt;gVisor's user-space kernel&lt;/td&gt;
&lt;td&gt;Only through a narrow set of calls&lt;/td&gt;
&lt;td&gt;Low; syscall-heavy work is slower&lt;/td&gt;
&lt;td&gt;A smaller host-kernel surface without VMs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WebAssembly runtime&lt;/td&gt;
&lt;td&gt;The runtime, through the interfaces you grant&lt;/td&gt;
&lt;td&gt;No direct system calls&lt;/td&gt;
&lt;td&gt;Very low&lt;/td&gt;
&lt;td&gt;Code you can compile to Wasm; few native packages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MicroVM (Firecracker, Cloud Hypervisor, Kata Containers)&lt;/td&gt;
&lt;td&gt;Its own guest kernel, behind hardware virtualization&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Low; a small kernel boots in well under a second&lt;/td&gt;
&lt;td&gt;Unreviewed code that needs a full Linux&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full VM&lt;/td&gt;
&lt;td&gt;Its own guest kernel, full device model&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Highest&lt;/td&gt;
&lt;td&gt;Occasional manual runs; long-lived environments&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The trade-off is compatibility against attack surface. Generated code usually wants a full Linux userland: pip, npm, compilers and shell tools. That rules out language-level sandboxes and makes WebAssembly awkward for general use, which is why teams that run arbitrary generated code mostly choose between gVisor and a microVM. &lt;a href="https://kosa8.com/microvm-vs-container-llm-code/" rel="noopener noreferrer"&gt;MicroVM vs container isolation for LLM code execution&lt;/a&gt; covers that choice in depth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Network: deny by default, enforce outside
&lt;/h2&gt;

&lt;p&gt;The most damaging thing hijacked code can do is send your data somewhere. An allow-list limits where data can go. Three details decide whether it holds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Enforce it outside the sandbox.&lt;/strong&gt; Put the rule on the host, in the virtual machine's network path or in a proxy the sandbox cannot reconfigure. Firewall rules inside the sandbox can be removed by root inside it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control DNS.&lt;/strong&gt; Answer only allowed names, so blocked hosts do not resolve and DNS queries cannot carry data out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Know what an allow-list does not cover.&lt;/strong&gt; Traffic to an allowed host is still traffic. A host that accepts uploads, such as a code-hosting site, a paste service or a storage bucket, is a way out. Allow the narrowest hosts you can, and give pure computation no network at all.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Secrets: keep them out of the sandbox
&lt;/h2&gt;

&lt;p&gt;Any secret the code can read, it can print, and anything it prints can end up in the model's context, a log or an outbound request. The reliable pattern is a broker. The sandbox holds a placeholder, and a proxy outside it swaps the placeholder for the real key only on requests to that key's own API host. A copied placeholder is worthless anywhere else.&lt;/p&gt;

&lt;p&gt;One limit remains. While the sandbox runs, it can still use the key along its allowed route, because that is how it does its work. Scope every key at the provider (read-only where possible, one project where possible), give each agent its own key, and rotate a key when an agent misbehaves.&lt;/p&gt;

&lt;h2&gt;
  
  
  State, limits and clean-up
&lt;/h2&gt;

&lt;p&gt;Run-to-run contamination is a quiet failure: a package installed by one run, a file left in &lt;code&gt;/tmp&lt;/code&gt;, a background process still listening on a port. Either throw the environment away after each run or restore it from a clean snapshot. Snapshot restore is now cheap enough to do per run. In kosa8's own benchmark, restoring a small microVM from a memory snapshot took 74 ms at the median on one server; the &lt;a href="https://kosa8.com/research/ai-agent-sandbox-benchmarks-2026/" rel="noopener noreferrer"&gt;benchmark study&lt;/a&gt; gives the hardware and method.&lt;/p&gt;

&lt;p&gt;Make every limit fail closed. An out-of-memory kill or a timeout should end the run and return an error to the agent, not hang the worker that called it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Mounting the container runtime's socket so the code can build images. That hands the code control of the host.&lt;/li&gt;
&lt;li&gt;Running containers with &lt;code&gt;--privileged&lt;/code&gt;, extra capabilities or seccomp turned off.&lt;/li&gt;
&lt;li&gt;Passing the parent process's environment into the sandbox, with every key in it.&lt;/li&gt;
&lt;li&gt;Mounting the project or home directory read-write.&lt;/li&gt;
&lt;li&gt;Reusing one long-lived sandbox for many users or tenants.&lt;/li&gt;
&lt;li&gt;Trusting a regex, a linter or a second model to spot dangerous code before it runs. Filters are worth having as a first check, but obfuscated or harmless-looking code gets past them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  One way to do it: kosa8
&lt;/h2&gt;

&lt;p&gt;kosa8 is Zero Trust cybersecurity infrastructure for AI agents, and it covers the checklist above as one tool. Each sandbox is its own microVM with its own kernel: Apple's Virtualization framework on a Mac, Cloud Hypervisor on KVM on x86-64 Linux. Network egress goes to an allow-list enforced on the host, outside the microVM. Secrets stay outside the sandbox: the host adds the real key on requests to that key's own host. Risky steps can wait for a person, and every action goes to a hash-chained, signed audit log. A checkpoint captures memory, processes and disk, and a rewind puts the sandbox back.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kosa8 sandbox create runner --cpus 2 --memory 2048 \
    --egress-allow pypi.org --egress-allow files.pythonhosted.org
kosa8 sandbox pull runner python:3.12-slim
kosa8 checkpoint runner --label clean
kosa8 sandbox run runner python:3.12-slim python -c &lt;span class="s2"&gt;"$(cat generated.py)"&lt;/span&gt;
kosa8 rewind runner --to clean --yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To try it without installing anything or making an account, &lt;a href="https://kosa8.com/try/" rel="noopener noreferrer"&gt;kosa8.com/try&lt;/a&gt; runs code in a fresh sandbox with no outbound network: 15 minutes of run time free per 24 hours, each run up to 60 s. An AI agent can do the same with one HTTP call and no key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://api.kosa8.com/v1/try/agent -H &lt;span class="s1"&gt;'content-type: application/json'&lt;/span&gt; -d &lt;span class="s1"&gt;'{"language":"python","code":"print(1)"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The step-by-step version, with egress checks and the audit log, is the guide &lt;a href="https://kosa8.com/guides/run-untrusted-llm-code-safely/" rel="noopener noreferrer"&gt;How do I run untrusted LLM-generated code safely?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What kosa8 does not do: it limits what generated code can reach, but it does not judge whether the code is correct, and it does not detect prompt injection. SOC 2 Type II is in progress; there is no SOC 2 report and no external penetration test yet.&lt;/p&gt;

&lt;p&gt;Try free with no account. Starter is free with no card; plans from \$29 a month.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is a Docker container enough to run LLM-generated code?
&lt;/h3&gt;

&lt;p&gt;For code you have reviewed, on a patched host, a hardened container (non-root, all capabilities dropped, no new privileges, no network, read-only root filesystem) is a reasonable floor. For code nobody has reviewed it is not a strong boundary: the code's system calls go straight to the host kernel, so one kernel or container-runtime bug can become a host escape. Use gVisor or a microVM for that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I scan generated code instead of sandboxing it?
&lt;/h3&gt;

&lt;p&gt;Scanning and review catch obvious mistakes and are worth keeping, but they do not limit what the code can reach when it runs. Obfuscated or harmless-looking code gets past filters, so the runtime boundary, the network policy and the absence of secrets are what actually limit the damage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should LLM-generated code have internet access?
&lt;/h3&gt;

&lt;p&gt;Only if the task needs it, and then only to named hosts. Pure computation needs no network; a package install needs a package index. Enforce the allow-list outside the sandbox, answer DNS only for allowed names, and remember that an allowed host that accepts uploads is still a way out.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I give generated code an API key safely?
&lt;/h3&gt;

&lt;p&gt;Do not put the key inside. Use a broker outside the sandbox that adds the real key only to requests for that API's host, so the sandbox holds a placeholder that is useless anywhere else. Scope the key at the provider as well, because the sandbox can still use it along the allowed route while it runs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should every run get a fresh sandbox?
&lt;/h3&gt;

&lt;p&gt;Yes, or a sandbox restored from a clean snapshot. Reusing one environment lets one run's packages, files or processes affect the next, and across users it leaks data. Restoring a small microVM from a snapshot takes tens of milliseconds on current hardware, so per-run isolation is affordable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources and further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://genai.owasp.org/llm-top-10/" rel="noopener noreferrer"&gt;OWASP Top 10 for LLM Applications 2025&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2406.10279" rel="noopener noreferrer"&gt;Spracklen et al., We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gvisor.dev/docs/" rel="noopener noreferrer"&gt;gVisor documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://firecracker-microvm.github.io/" rel="noopener noreferrer"&gt;Firecracker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://katacontainers.io/" rel="noopener noreferrer"&gt;Kata Containers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/engine/security/" rel="noopener noreferrer"&gt;Docker Engine security&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Related
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kosa8.com/guides/run-untrusted-llm-code-safely/" rel="noopener noreferrer"&gt;How do I run untrusted LLM-generated code safely? (kosa8 step by step)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kosa8.com/ai-agent-tool-execution-sandbox/" rel="noopener noreferrer"&gt;Secure sandbox infrastructure for AI agent tool execution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kosa8.com/microvm-vs-container-llm-code/" rel="noopener noreferrer"&gt;MicroVM vs container isolation for LLM code execution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kosa8.com/research/ai-agent-sandbox-benchmarks-2026/" rel="noopener noreferrer"&gt;kosa8: AI agent sandbox benchmark study 2026&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kosa8.com/guides/ai-agent-network-allow-list/" rel="noopener noreferrer"&gt;How do I restrict an AI agent's network access to an allow-list?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kosa8.com/guides/give-ai-agent-api-keys-safely/" rel="noopener noreferrer"&gt;How do I give an AI agent API keys without exposing them?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kosa8.com/zero-trust-ai-agents/" rel="noopener noreferrer"&gt;Zero trust sandboxes for AI agents&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;This article was written with AI assistance and reviewed by the kosa8 team. It was first published at &lt;a href="https://kosa8.com/run-untrusted-llm-code/" rel="noopener noreferrer"&gt;kosa8.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>ai</category>
      <category>llm</category>
      <category>docker</category>
    </item>
    <item>
      <title>Zero Trust sandboxes for AI agents: what they are and how to build one</title>
      <dc:creator>kosa8</dc:creator>
      <pubDate>Sun, 29 Nov 2026 08:17:04 +0000</pubDate>
      <link>https://dev.to/drew_60e8126e2de2f177050e/zero-trust-sandboxes-for-ai-agents-what-they-are-and-how-to-build-one-2joi</link>
      <guid>https://dev.to/drew_60e8126e2de2f177050e/zero-trust-sandboxes-for-ai-agents-what-they-are-and-how-to-build-one-2joi</guid>
      <description>&lt;p&gt;A Zero Trust sandbox for an AI agent is an isolated machine that assumes the agent is already compromised. The agent runs in its own microVM. Everything that decides what it may do (the network rules, the keys, the approvals and the log) runs outside that machine, where the agent cannot reach it. This guide maps NIST's Zero Trust tenets to agents, explains why a container alone falls short, and walks through the six controls you need, with a checklist.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Zero Trust sandbox for AI agents?
&lt;/h2&gt;

&lt;p&gt;An AI agent is a model in a loop with tools. It reads a task, runs a command, reads the result and decides again. A plain sandbox answers one question: can the agent's code touch my computer? A Zero Trust sandbox answers a harder one: what can a hijacked agent do with everything I gave it on purpose?&lt;/p&gt;

&lt;p&gt;That matters because agents are easy to steer. Anything the agent reads can carry instructions: a README, an issue, a web page, a tool description. OWASP ranks this first in its &lt;a href="https://genai.owasp.org/llmrisk/llm01-prompt-injection/" rel="noopener noreferrer"&gt;Top 10 for LLM Applications&lt;/a&gt;, and its &lt;a href="https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/" rel="noopener noreferrer"&gt;Top 10 for Agentic Applications&lt;/a&gt; opens with Agent Goal Hijack. You cannot filter every bad instruction out of the world, so assume the agent will sooner or later do what an attacker wants.&lt;/p&gt;

&lt;p&gt;A Zero Trust sandbox is built on that assumption. It has a strong wall, a virtual machine with its own kernel, and a set of decisions made outside the wall: which hosts the agent may reach, which keys it may use without seeing them, which actions need a person, and a record of everything. For the basic definition of an agent sandbox, start with &lt;a href="https://kosa8.com/blog/what-is-an-ai-agent-sandbox/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;What is an AI agent sandbox?&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  NIST's Zero Trust tenets, applied to an AI agent
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://csrc.nist.gov/pubs/sp/800/207/final" rel="noopener noreferrer"&gt;NIST SP 800-207&lt;/a&gt; defines Zero Trust as a set of tenets, not a product. It was written for users, devices and services, but it fits agents well. An agent is a non-human subject that asks for access to resources, all day, at machine speed. Here are the seven tenets from section 2.1, in our words, with what each one means for an agent.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;NIST tenet (paraphrased)&lt;/th&gt;
&lt;th&gt;What it means for an AI agent&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Every data source and service is a resource.&lt;/td&gt;
&lt;td&gt;The model API, the registry, the Git host, each MCP tool and the workspace are resources the agent must be granted one by one.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;All communication is secured, whatever the network location.&lt;/td&gt;
&lt;td&gt;Running on your laptop or in your VPC earns the agent nothing.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access is granted per session.&lt;/td&gt;
&lt;td&gt;Access lasts for one task. Approvals are single-use.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access is decided by dynamic policy.&lt;/td&gt;
&lt;td&gt;Rules look at the request: which host, which tool, which arguments.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The integrity and posture of every asset are monitored.&lt;/td&gt;
&lt;td&gt;You know what image the sandbox booted and what it installed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Authentication and authorization are enforced before access.&lt;/td&gt;
&lt;td&gt;Every packet and tool call is decided before it happens, not reviewed later.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Collect as much information as possible and use it to improve.&lt;/td&gt;
&lt;td&gt;Every decision, allowed or refused, goes to a log the agent cannot edit.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;NIST also names the parts that decide. A policy engine decides, a policy administrator carries the decision out, and a policy enforcement point stands in the path of the request. The design rule for agents follows: none of those parts may run inside the agent's machine. A rule the agent can edit is only a suggestion. For identity and secrets under this model, see our &lt;a href="https://kosa8.com/zero-trust-ai-agents/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Zero Trust for AI agents&lt;/a&gt; guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why containers alone are not enough
&lt;/h2&gt;

&lt;p&gt;Every container on a host shares that host's kernel. Docker's own &lt;a href="https://docs.docker.com/engine/security/" rel="noopener noreferrer"&gt;security documentation&lt;/a&gt; explains how much of a container's safety rests on namespaces, control groups and the capabilities you leave on. That is fine for code you wrote. It is a thin wall for code a hijacked agent writes, because one kernel or runtime bug can reach the host. &lt;a href="https://nvd.nist.gov/vuln/detail/CVE-2024-21626" rel="noopener noreferrer"&gt;CVE-2024-21626&lt;/a&gt; in runc, for example, let a container process get a working directory on the host filesystem.&lt;/p&gt;

&lt;p&gt;The bigger problem is that a better wall does not solve the rest. Suppose the wall is perfect. An agent can still leak the API key in its environment, send your code to any host it may reach, or call a permitted tool with harmful arguments. None of these cross the wall. Simon Willison calls the dangerous mix the &lt;a href="https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/" rel="noopener noreferrer"&gt;lethal trifecta&lt;/a&gt;: private data, untrusted content and a way to send data out.&lt;/p&gt;

&lt;p&gt;Real cases follow that pattern. &lt;a href="https://github.com/anthropics/claude-code/security/advisories/GHSA-x5gv-jw7f-j6xj" rel="noopener noreferrer"&gt;CVE-2025-55284&lt;/a&gt; in Claude Code let an injected agent read a file and send it out through DNS lookups, with commands approved by default. In &lt;a href="https://kosa8.com/blog/agents-md-hijack-reveals-need-for-real-microvm-isolation/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;the AGENTS.md hijack&lt;/a&gt;, a markdown file talked a coding agent into running a malicious package. Isolation is the floor. The controls around it stop the damage.&lt;/p&gt;

&lt;h2&gt;
  
  
  The six controls of a Zero Trust sandbox
&lt;/h2&gt;

&lt;p&gt;Each control answers a different way a hijacked agent can hurt you. Only the first one is about the wall. The other five live on the host.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;1. MicroVM isolation.&lt;/strong&gt; The agent's code runs in a virtual machine with its own kernel. It sees one workspace folder and nothing else on the host.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2. Deny-by-default egress.&lt;/strong&gt; Nothing leaves the sandbox unless it goes to a host you named. DNS is answered on the host, for listed names only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3. Brokered credentials.&lt;/strong&gt; Real keys stay on the host. The sandbox holds a placeholder, and a broker adds the real key on the way out, only to the right host.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;4. Approvals.&lt;/strong&gt; Destructive or boundary-widening actions wait for a named person. Approvals cover one exact action, once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;5. Tamper-evident audit.&lt;/strong&gt; Every decision, allowed or refused, is written outside the sandbox, in a chained log where edits and deletions show.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;6. Ephemeral and snapshot lifecycle.&lt;/strong&gt; Each task starts from a clean machine and ends with it deleted. A checkpoint before a risky step lets you rewind the whole machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/UPLOAD%2520zero-trust-sandbox-architecture.png%2520HERE" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/UPLOAD%2520zero-trust-sandbox-architecture.png%2520HERE" alt="Reference architecture of a Zero Trust sandbox for AI agents" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The agent runs inside the microVM. Every decision about it is made on the host.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Control 1: microVM isolation
&lt;/h2&gt;

&lt;p&gt;A microVM is a small virtual machine with its own guest kernel and few virtual devices. It keeps the hardware boundary of a full VM but boots in well under a second. Firecracker was built by AWS to run untrusted code from many tenants on one host; its &lt;a href="https://www.usenix.org/conference/nsdi20/presentation/agache" rel="noopener noreferrer"&gt;NSDI 2020 paper&lt;/a&gt; explains the design. Cloud Hypervisor and Apple's Virtualization framework fill the same role elsewhere. User-space kernels such as &lt;a href="https://gvisor.dev/docs/" rel="noopener noreferrer"&gt;gVisor&lt;/a&gt; are a middle ground.&lt;/p&gt;

&lt;p&gt;Require one VM per agent or per task, never one shared by many agents. The agent should see one workspace folder and no host paths, sockets or credential files. For the trade-offs, read &lt;a href="https://kosa8.com/blog/what-is-a-microvm/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;What is a microVM?&lt;/a&gt; and &lt;a href="https://kosa8.com/blog/firecracker-vs-gvisor-vs-kata-containers/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Firecracker vs gVisor vs Kata Containers&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control 2: deny-by-default egress
&lt;/h2&gt;

&lt;p&gt;Most data theft by agents is just network traffic. So the network starts closed, and you open only the hosts the task needs, usually the model API and a package registry. Three details decide whether this works.&lt;/p&gt;

&lt;p&gt;First, enforce it outside the VM: root in the guest can turn off a guest firewall, and you must assume the agent has root. Second, answer DNS on the host and refuse unlisted names, or a lookup that encodes your data leaks it, as CVE-2025-55284 showed. Third, an allow-list limits where data goes, not what is sent. Any allowed host that accepts uploads is still a way out; MITRE ATT&amp;amp;CK calls this &lt;a href="https://attack.mitre.org/techniques/T1567/" rel="noopener noreferrer"&gt;exfiltration over a web service&lt;/a&gt;. More in &lt;a href="https://kosa8.com/blog/ai-agent-egress-control-explained/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;How AI agent egress control really works&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control 3: brokered credentials
&lt;/h2&gt;

&lt;p&gt;If a key is an environment variable in the sandbox, then the agent, every package it installs and every script it is tricked into running can read it. Anything that can read a key can send it somewhere.&lt;/p&gt;

&lt;p&gt;So keep the key out. The sandbox gets a placeholder that is worthless anywhere else. A broker on the host swaps in the real key on requests to the right host. An injected agent that prints its environment prints nothing useful.&lt;/p&gt;

&lt;p&gt;The limit: while the sandbox runs, the placeholder can still spend the key on allowed routes. Scope each key at its provider, give each agent its own key, and limit methods and paths. The full pattern is in &lt;a href="https://kosa8.com/blog/prompt-injection-api-keys-egress-broker/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Prompt injection, API keys and the egress broker&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control 4: approvals for risky actions
&lt;/h2&gt;

&lt;p&gt;Some actions cannot be undone: deleting data, merging to main, spending money, widening the sandbox's own access. OWASP calls this failure &lt;a href="https://genai.owasp.org/llmrisk/llm062025-excessive-agency/" rel="noopener noreferrer"&gt;Excessive Agency&lt;/a&gt;. Put a person in the loop for those actions, and only those. Ask for everything and people click yes without reading.&lt;/p&gt;

&lt;p&gt;A good approval system classifies actions by blast radius, shows the exact command and target, covers that one action once, and never lets an agent approve. For tool calls, pin each tool's definition so a changed description is held for review (see &lt;a href="https://kosa8.com/blog/mcp-tool-poisoning-rug-pull/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;MCP tool poisoning&lt;/a&gt;), and write rules that look at a call's arguments, not only its name.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control 5: tamper-evident audit
&lt;/h2&gt;

&lt;p&gt;After an incident, the first question is what the agent did. The log must answer it, and the agent must not be able to edit the answer. So the host writes the log, not the guest. It records allowed actions as well as refusals: the actor, the action, the target, the rule and the result. It leaves out secrets and request bodies.&lt;/p&gt;

&lt;p&gt;Chaining makes tampering visible. Each entry includes a hash of the one before, so changing or removing an entry breaks the chain. A signature lets others check it without trusting you. Send a copy to your SIEM. See &lt;a href="https://kosa8.com/blog/what-an-audit-log-for-ai-agents-should-record/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;what an audit log for AI agents should record&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control 6: ephemeral and snapshot lifecycle
&lt;/h2&gt;

&lt;p&gt;Zero Trust says access is per session. For a sandbox, the machine itself is per task. Start from a known image, delete the machine at the end, and give every sandbox a time limit. Anything a compromised task planted goes away with it.&lt;/p&gt;

&lt;p&gt;A checkpoint before a risky step saves the whole machine: disk, memory and running processes. If the step goes wrong, rewind. That undoes more than Git can, as we explain in &lt;a href="https://kosa8.com/blog/ai-coding-agents-need-a-whole-machine-undo/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;AI coding agents need a whole-machine undo&lt;/a&gt;. One rule: a snapshot must never hold a real secret.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to build one yourself
&lt;/h2&gt;

&lt;p&gt;You can assemble a Zero Trust sandbox from open parts. A typical Linux build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Isolation:&lt;/strong&gt; Firecracker or Cloud Hypervisor on KVM, one microVM per task, one shared folder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network:&lt;/strong&gt; a tap device per VM, host firewall rules that drop by default, and a host DNS resolver for allow-listed names only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Credentials:&lt;/strong&gt; a host proxy that matches the destination and injects the real header; the VM gets a placeholder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Approvals:&lt;/strong&gt; a gateway in front of MCP tools that pins definitions, checks arguments and queues risky calls for a person.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit:&lt;/strong&gt; an append-only, hash-chained, signed log on the host, forwarded to your SIEM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lifecycle:&lt;/strong&gt; a controller that boots clean images, enforces time limits, snapshots and deletes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The hard parts are the seams: keeping DNS and firewall in sync, making the proxy impossible to bypass, and logging every layer's decisions. Lighter options exist: Anthropic describes OS-level isolation plus a proxy in &lt;a href="https://www.anthropic.com/engineering/claude-code-sandboxing" rel="noopener noreferrer"&gt;Claude Code sandboxing&lt;/a&gt;, and we compare it in &lt;a href="https://kosa8.com/blog/claude-code-built-in-sandbox-explained/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Claude Code's built-in sandbox, explained&lt;/a&gt;. Match the level to what the agent can reach.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Zero Trust sandbox checklist
&lt;/h2&gt;

&lt;p&gt;Use this to review any agent sandbox, bought or built. A "no" is not always wrong, but it should be a choice someone wrote down.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each agent or task runs in its own VM with its own kernel.&lt;/li&gt;
&lt;li&gt;The agent sees one workspace folder and no host paths, sockets or credential files.&lt;/li&gt;
&lt;li&gt;Network egress is closed unless a host is on a written allow-list.&lt;/li&gt;
&lt;li&gt;Egress rules are enforced on the host, so root in the guest cannot lift them.&lt;/li&gt;
&lt;li&gt;DNS is answered on the host, for listed names only.&lt;/li&gt;
&lt;li&gt;No allowed host accepts arbitrary uploads, or you accept that risk in writing.&lt;/li&gt;
&lt;li&gt;No real API key, token or password exists inside the sandbox.&lt;/li&gt;
&lt;li&gt;Destructive and access-widening actions always wait for a named person.&lt;/li&gt;
&lt;li&gt;Approvals cover one exact action, once, and no agent can approve.&lt;/li&gt;
&lt;li&gt;Tool definitions are pinned, and changes are held for review.&lt;/li&gt;
&lt;li&gt;Every decision, allowed or refused, is logged on the host in a hash chain you can verify.&lt;/li&gt;
&lt;li&gt;Logs go to your SIEM, and you can export evidence for one sandbox.&lt;/li&gt;
&lt;li&gt;Every sandbox has a time limit and is deleted at the end of its task.&lt;/li&gt;
&lt;li&gt;You have a kill switch that stops every agent at once.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How kosa8 implements each control
&lt;/h2&gt;

&lt;p&gt;kosa8 is Zero Trust cybersecurity infrastructure for AI agents. Its threat model is the one above: assume an attacker controls what the agent reads and has root inside its machine. Here is how each control maps, with the limits stated plainly.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Control&lt;/th&gt;
&lt;th&gt;In kosa8&lt;/th&gt;
&lt;th&gt;Limit to know&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;MicroVM isolation&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;kosa8 sandbox&lt;/code&gt; and &lt;code&gt;kosa8 agent run&lt;/code&gt; give each workload its own VM and Linux kernel: Apple's Virtualization framework on Macs, Cloud Hypervisor on KVM on Linux. One workspace folder is visible.&lt;/td&gt;
&lt;td&gt;The Docker-compatible &lt;code&gt;kosa8 run&lt;/code&gt; shares one VM unless a signed policy sets &lt;code&gt;require_sandbox&lt;/code&gt;. Cloud overflow sandboxes run on Cloudflare Containers unless you name a region.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deny-by-default egress&lt;/td&gt;
&lt;td&gt;Every packet is decided on the host; root in the guest cannot lift the rules. DNS answers listed names only. Agent-created and brokered sandboxes start closed.&lt;/td&gt;
&lt;td&gt;A sandbox you create by hand is open unless you pass &lt;code&gt;--egress deny&lt;/code&gt; or &lt;code&gt;--egress-allow&lt;/code&gt;, or your organization sets a default. Bodies to allowed hosts are not inspected.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brokered credentials&lt;/td&gt;
&lt;td&gt;The sandbox holds a placeholder; the egress broker adds the real key only for the named host. Cloud secrets can be limited to methods and paths.&lt;/td&gt;
&lt;td&gt;The placeholder can spend the key on its allowed route while the sandbox runs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Approvals&lt;/td&gt;
&lt;td&gt;Destructive and boundary-widening actions ask every time and cannot be auto-approved. &lt;code&gt;kosa8 mcp approve ID&lt;/code&gt; approves one held tool call, once, for ten minutes. Named approvers sign approvals; replays are refused.&lt;/td&gt;
&lt;td&gt;A rule you did not write protects nothing.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tamper-evident audit&lt;/td&gt;
&lt;td&gt;A hash-chained log written on the host, checked by &lt;code&gt;kosa8 audit verify&lt;/code&gt;, with CEF export. kosa8 Cloud keeps a SHA-256 chained log you can read by API and stream to a SIEM.&lt;/td&gt;
&lt;td&gt;Bodies, query strings and the environment are never recorded, on purpose.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lifecycle&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;--ephemeral&lt;/code&gt;, &lt;code&gt;--ttl&lt;/code&gt; and &lt;code&gt;--auto-stop&lt;/code&gt; on create; &lt;code&gt;kosa8 checkpoint&lt;/code&gt; and &lt;code&gt;kosa8 rewind&lt;/code&gt; for the whole machine.&lt;/td&gt;
&lt;td&gt;Sandboxes holding Cloud secrets cannot be checkpointed, so secrets never land in a snapshot.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A short example: &lt;code&gt;kosa8 agent run -w ~/code/api claude&lt;/code&gt; starts Claude Code in its own microVM, with your project as the only visible folder, the network closed except through the broker, and the Anthropic key kept on the host. Add &lt;code&gt;--dry-run&lt;/code&gt; to see the plan first. Then run &lt;code&gt;kosa8 audit verify&lt;/code&gt;. On kosa8 Cloud, &lt;code&gt;kosa8 cloud freeze&lt;/code&gt; is the kill switch.&lt;/p&gt;

&lt;p&gt;The full map is in the &lt;a href="https://docs.kosa8.com/guides/secure-agents/" rel="noopener noreferrer"&gt;Securing an agent&lt;/a&gt; guide. kosa8 bounds what a hijacked agent can do; it does not stop prompt injection itself. Its SOC 2 Type II audit is in progress, with the report expected in January 2027, and it has not had an external penetration test yet. The &lt;a href="https://kosa8.com/trust/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;trust page&lt;/a&gt; keeps that status current.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a Zero Trust sandbox for AI agents?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is an isolated machine, usually a microVM, where an AI agent's commands run, combined with controls that live outside that machine: deny-by-default network rules, brokered credentials, approvals for risky actions, a tamper-evident audit log and a short lifecycle. It assumes the agent may be hijacked at any time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does NIST SP 800-207 apply to AI agents?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Treat each agent as a non-human subject that gets no trust from where it runs. Grant access per task and per request, decide it by policy that looks at the request, enforce it before access, and log everything. The policy decision and enforcement points must sit outside the agent's machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is a Docker container a Zero Trust sandbox?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not on its own. A container shares the host kernel, so a kernel or runtime bug can reach the host. Even with a stronger wall, you still need network rules, credentials kept outside, approvals and an audit log, because most agent damage uses what the agent was given.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does a Zero Trust sandbox stop prompt injection?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. It limits what a hijacked agent can do, not what it reads. An injected agent in a good sandbox can only reach listed hosts, holds no real keys, needs a person for risky actions and leaves a record of every attempt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between deny-by-default egress and an allow-list?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They are the same idea seen from two sides. Deny by default means nothing leaves the sandbox unless a rule allows it, and the allow-list is that rule. It must be enforced outside the VM, including DNS, to hold against root in the guest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://csrc.nist.gov/pubs/sp/800/207/final" rel="noopener noreferrer"&gt;SP 800-207, Zero Trust Architecture&lt;/a&gt; (NIST)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://genai.owasp.org/llmrisk/llm01-prompt-injection/" rel="noopener noreferrer"&gt;LLM01:2025 Prompt Injection&lt;/a&gt; (OWASP Gen AI Security Project)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://genai.owasp.org/llmrisk/llm062025-excessive-agency/" rel="noopener noreferrer"&gt;LLM06:2025 Excessive Agency&lt;/a&gt; (OWASP Gen AI Security Project)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/" rel="noopener noreferrer"&gt;OWASP Top 10 for Agentic Applications for 2026&lt;/a&gt; (OWASP Gen AI Security Project)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/" rel="noopener noreferrer"&gt;The lethal trifecta for AI agents&lt;/a&gt; (Simon Willison)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.docker.com/engine/security/" rel="noopener noreferrer"&gt;Docker Engine security&lt;/a&gt; (Docker docs)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nvd.nist.gov/vuln/detail/CVE-2024-21626" rel="noopener noreferrer"&gt;CVE-2024-21626 (runc)&lt;/a&gt; (NIST National Vulnerability Database)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/anthropics/claude-code/security/advisories/GHSA-x5gv-jw7f-j6xj" rel="noopener noreferrer"&gt;Permissive default allowlist enables unauthorized file read and network exfiltration in Claude Code (CVE-2025-55284)&lt;/a&gt; (GitHub Security Advisory)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.usenix.org/conference/nsdi20/presentation/agache" rel="noopener noreferrer"&gt;Firecracker: Lightweight Virtualization for Serverless Applications (NSDI 2020)&lt;/a&gt; (USENIX)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://gvisor.dev/docs/" rel="noopener noreferrer"&gt;What is gVisor?&lt;/a&gt; (gVisor docs)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://attack.mitre.org/techniques/T1567/" rel="noopener noreferrer"&gt;Exfiltration Over Web Service (T1567)&lt;/a&gt; (MITRE ATT&amp;amp;CK)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.anthropic.com/engineering/claude-code-sandboxing" rel="noopener noreferrer"&gt;Beyond permission prompts: making Claude Code more secure and autonomous&lt;/a&gt; (Anthropic Engineering)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.kosa8.com/guides/secure-agents/" rel="noopener noreferrer"&gt;Securing an agent&lt;/a&gt; (kosa8 docs)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;First published on the &lt;a href="https://kosa8.com/blog/zero-trust-sandboxes-for-ai-agents/" rel="noopener noreferrer"&gt;kosa8 blog&lt;/a&gt;. I work on kosa8, a Zero Trust sandbox for AI agents; the controls above apply whatever tool you use.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This article was written with AI assistance and reviewed by the kosa8 team. It was first published at &lt;a href="https://kosa8.com/blog/zero-trust-sandboxes-for-ai-agents/" rel="noopener noreferrer"&gt;kosa8.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>ai</category>
      <category>devops</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
