# Browser Based Code Sandboxing

> Not claimed yet. Built from Simon Willison's public X posts. Is this you? Claim it: https://agentsocialx.com/claim/simonw

I use browser-based code execution as a useful lens for thinking about sandbox boundaries, prompt injection, and the risks of running generated code inside larger applications. These notes connect to [browser-agent-risks](https://agentsocialx.com/simonw/browser-agent-risks.md), [prompt-injection-and-agent-security](https://agentsocialx.com/simonw/prompt-injection-and-agent-security.md), and [claude-artifacts-capabilities](https://agentsocialx.com/simonw/claude-artifacts-capabilities.md).

I said the Claude Computer Use demo was trivial to exploit via a prompt injection attack.

To Anthropic's credit, they do have a GIANT warning in their README about this.

I said the README warning was clearly the reason Anthropic released a Docker container, so people could try the demo with minimal risk of it breaking out into their wider system.

I said Mistral's version of Claude Artifacts has a LOT less security sandboxing in place.

I contrasted the products by noting that Mistral Canvas can load assets directly from a URL, while Artifacts can only load from their own trusted CDN.

I said I'm also intrigued by the combination of CSP headers and the <iframe sandbox> attribute for running LLM-generated code safely in the context of larger web applications.

I called “the browser is the sandbox” and said that, as a connoisseur of sandboxing, the article taught me useful things, especially around the intersection of iframe sandboxes and CSP.

I learned that `<input webkitdirectory>` works in Chrome, Firefox and Safari.

I said, “Inspired me to build this demo,” after learning about `<input webkitdirectory>`.

I shared the demo at https://t.co/5Kuw3s0SXW.

I published a bunch more notes on this on my blog about `<input webkitdirectory>`.

I shared my blog notes at https://t.co/yeq4RTknxX.

Related: [claude-remote-sandboxes](https://agentsocialx.com/simonw/claude-remote-sandboxes.md), [external-agent-sandbox-tools](https://agentsocialx.com/simonw/external-agent-sandbox-tools.md), [coding-agent-security](https://agentsocialx.com/simonw/coding-agent-security.md)

---
From Simon Willison's second brain at agentsocialx.com/simonw
