smolvm 1.8.3 沙箱实测:适合隔离运行不可信 Python 与 JavaScript

Simon Willison 博客·2026-08-20 07:16·4天前·Simon Willison
AI 导读

对 smolvm 1.8.3 的测试显示,它适合用硬件隔离 VM 而非共享内核容器来沙箱运行不可信的 Python 和 JavaScript 数据转换任务。离线本地镜像、无网络执行、CPU/内存限制、访客强制超时、存储配额、只读输入挂载、可写输出挂载及 --unprivileged 均按预期工作,冷启动约 0.6–1.5 秒,热执行约 50 毫秒。

Simon Willison 博客
66AI 编辑部评分,满分 100

smolvm 1.8.3 沙箱实测:适合隔离运行不可信 Python 与 JavaScript

2026-08-20 07:16· 4天前· Simon Willison
AI 导读

对 smolvm 1.8.3 的测试显示,它适合用硬件隔离 VM 而非共享内核容器来沙箱运行不可信的 Python 和 JavaScript 数据转换任务。离线本地镜像、无网络执行、CPU/内存限制、访客强制超时、存储配额、只读输入挂载、可写输出挂载及 --unprivileged 均按预期工作,冷启动约 0.6–1.5 秒,热执行约 50 毫秒。

— Testing smolvm 1.8.3 shows it is well suited for sandboxing untrusted Python and JavaScript data transformations using hardware-isolated VMs rather than shared-kernel containers. Offline local images, no-network execution, CPU/RAM limits, guest-enforced timeouts, storage quotas, read-only input mounts, writable output mounts, and `--unprivileged` all worked as intended, with cold starts around 0.6–1.5 seconds and warm executions around 50 ms.

I tasked Claude Fable 5 running in Claude Code for web with the following research task:

Put https://smolmachines.com through its paces as a fast secure sandbox. Explore what it would take to use this to run untrusted Python and JavaScript code in a way that is limited in what RAM and CPU time it can take up (protection against "while true") with no network access and filesystem access only to designated files

Goal is to be able to use this to execute user-provided tasks for things like data transformations

It quickly ran into a problem: the Claude Code for web environment can't run smol machines. Quoting the notes it wrote:

  • This Claude Code container: Linux 6.18.5-fc-v20 (itself a Firecracker guest), 4 vCPU, 15GB RAM. No /dev/kvm, no vmx/svm CPU flags → no nested virt.
  • smolvm machine run fails as expected: "kvm not available".
  • Plan B: GitHub Actions ubuntu runners DO expose /dev/kvm → run the real test battery via a temporary workflow on this branch, collect logs, remove workflow in final commit.

And Plan B is what it did, installing smolvm and running these tests directly in a GitHub Actions runner against that branch.

That was a creative solution to the environmental limits posed by Claude Code for web. Another example of Fable being relentlessly proactive.

19th August 2026

来源:Simon Willison 博客· simonwillison.net