zlacker

Deno Sandbox

submitted by johnsp+(OP) on 2026-02-03 17:33:20 | 525 points 167 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
◧◩
10. motrm+Ud[view] [source] [discussion] 2026-02-03 18:24:44
>>emschw+Hb
Reminds me a little of Fly's Tokenizer - https://github.com/superfly/tokenizer

It's a little HTTP proxy that your application can route requests through, and the proxy is what handles adding the API keys or whatnot to the request to the service, rather than your application, something like this for example:

Application -> tokenizer -> Stripe

The secrets for the third party service should in theory then be safe should there be some leak or compromise of the application since it doesn't know the actual secrets itself.

Cool idea!

◧◩
11. simonw+8e[view] [source] [discussion] 2026-02-03 18:25:30
>>emschw+Hb
Yeah, this is a really neat idea: https://deno.com/blog/introducing-deno-sandbox#secrets-that-...

  await using sandbox = await Sandbox.create({
    secrets: {
      OPENAI_API_KEY: {
        hosts: ["api.openai.com"],
        value: process.env.OPENAI_API_KEY,
      },
    },
  });
  
  await sandbox.sh`echo $OPENAI_API_KEY`;
  // DENO_SECRET_PLACEHOLDER_b14043a2f578cba75ebe04791e8e2c7d4002fd0c1f825e19...
It doesn't prevent bad code from USING those secrets to do nasty things, but it does at least make it impossible for them to steal the secret permanently.

Kind of like how XSS attacks can't read httpOnly cookies but they can generally still cause fetch() requests that can take actions using those cookies.

13. simonw+Oe[view] [source] 2026-02-03 18:27:48
>>johnsp+(OP)
Note that you don't need to use Deno or JavaScript at all to use this product. Here's their Python client SDK: https://pypi.org/project/deno-sandbox/

  from deno_sandbox import DenoDeploy
  
  sdk = DenoDeploy()
  
  with sdk.sandbox.create() as sb:
      # Run a shell command
      process = sb.spawn("echo", args=["Hello from the sandbox!"])
      process.wait()
  
      # Write and read files
      sb.fs.write_text_file("/tmp/example.txt", "Hello, World!")
      content = sb.fs.read_text_file("/tmp/example.txt")
      print(content)
Looks like the API protocol itself uses websockets: https://tools.simonwillison.net/zip-wheel-explorer?package=d...
15. nihaku+lf[view] [source] 2026-02-03 18:29:41
>>johnsp+(OP)
See also Sprites (>>46557825 ) which I've been using and really enjoying. There are some key architecture differences between the two, but very similar surface area. It'll be interesting to see if ephemeral + snapshots can be as convenient as stateful with cloning/forking (which hasn't actually dropped yet, although the fly team say it's coming).

Will give these a try. These are exciting times, it's never been a better time to build side projects :)

◧◩
17. verdve+rf[view] [source] [discussion] 2026-02-03 18:30:14
>>emschw+Hb
Dagger has a similar feature: https://docs.dagger.io/getting-started/types/secret/

Same idea with more languages on OCI. I believe they have something even better in the works, that bundles a bunch of things you want in an "env" and lets you pass that around as a single "pointer"

I use this here, which eventually becomes the sandbox my agent operates in: https://github.com/hofstadter-io/hof/blob/_next/.veg/contain...

◧◩
19. linole+kg[view] [source] [discussion] 2026-02-03 18:33:12
>>emschw+Hb
It’s pretty neat.

Had some previous discussion that may be interesting on >>46595393

◧◩
32. falcor+au[view] [source] [discussion] 2026-02-03 19:26:55
>>ATechG+Vm
Well, this is the hard part, but the idea is that if you're working with both untrusted inputs and private data/resources, then your agent is susceptible to the "lethal trifecta"[0], and you should be extremely limiting in its ability to have external network access. I would suggest starting with nothing beyond the single AI provider you're using, and only add additional domains if you are certain you trust them and can't do without them.

[0] https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/

◧◩◪
35. zenmac+Mu[view] [source] [discussion] 2026-02-03 19:29:18
>>drewbi+Fs
Saw quite bit on HN.

A quick search this popped up:

>>45486006

If we can spin up microVM so quickly, why bother with Docker or other containers at all?

◧◩◪◨⬒
48. tptace+aC[view] [source] [discussion] 2026-02-03 20:03:16
>>svieir+uz
Like the Tokenizer, I think they're open source.

https://fly.io/blog/operationalizing-macaroons/

◧◩◪
53. ushako+5F[view] [source] [discussion] 2026-02-03 20:16:14
>>echelo+0x
we have 100% open-source Sandboxes at E2B

git: https://github.com/e2b-dev/infra

wiki: https://deepwiki.com/e2b-dev/infra

67. dangoo+jN[view] [source] 2026-02-03 20:54:21
>>johnsp+(OP)
Love their network filtering, however it definitely lacks some capabilities (like the ability to do direct TCP connections to Postgres, or direct IP connections.

Those limitations from other tools was exactly why I made https://github.com/danthegoodman1/netfence for our agents

77. EGreg+jT[view] [source] 2026-02-03 21:26:22
>>johnsp+(OP)
We already have a pretty good sandbox in our platform: https://github.com/Qbix/Platform/blob/main/platform/plugins/...

It uses web workers on a web browser. So is this Deno Sandbox like that, but for server? I think Node has worker threads.

◧◩◪◨
117. tczMUF+lK1[view] [source] [discussion] 2026-02-04 02:46:50
>>booi+tS
This is effectively what happened with the BotGhost vulnerability a few months back:

>>44359619

◧◩◪
121. dtkav+3P1[view] [source] [discussion] 2026-02-04 03:30:15
>>motrm+Ud
I've been working on something similar (with claude code).

It's a sandbox that uses envoy as a transparent proxy locally, and then an external authz server that can swap the creds.

The idea is extended further in that the goal is to allow an org to basically create their own authz system for arbitrary upstreams, and then for users to leverage macaroons to attentuate the tokens at runtime.

It isn't finished but I'm trying to make it work with ssh/yubikeys as an identity layer. The authz macaroon can have a "hole" that is filled by the user/device attestation.

The sandbox has some nice features like browser forwarding for Claude oauth and a CDP proxy for working with Chrome/Electron (I'm building an Obsidian plugin).

I'm inspired by a lot of the fly.io stuff in tokenizer and sprites. Exciting times.

https://github.com/dtkav/agent-creds

◧◩
127. freaky+r22[view] [source] [discussion] 2026-02-04 05:47:55
>>eis+EM1
Ditto... but it's more like 30x.

Mentioned the same in this comment as well: >>46881920

143. arjan_+qB2[view] [source] 2026-02-04 10:37:02
>>johnsp+(OP)
This sandboxing solution list is getting long... created https://github.com/arjan/awesome-agent-sandboxes, PRs welcome :)
147. nihaku+pN2[view] [source] 2026-02-04 12:04:32
>>johnsp+(OP)
Not sure if anyone from the deno team is monitoring this forum, but I was trying to stand up a dev-base snapshot and pretty quickly ran into a wall. Is it not currently possible to create a bootable volume from the CLI? https://docs.deno.com/sandbox/volumes/#creating-a-snapshot has an example for the js API, but the CLI equivalent isn't specifying --from and the latest verson of the deno CLI installed fresh from deno.land has no --from option. Is the CLI behind, here? Or is the argument provided some other way?
160. earlen+0Y4[view] [source] 2026-02-04 23:05:38
>>johnsp+(OP)
Fun! Our work from 10 years ago introduced the secrets protection technique being used in Deno: https://www.earlence.com/assets/papers/flowfence_sec16.pdf and fly's tokenizer. We called it "opaque computation" and it did a lot more than secrets protection.
164. regisb+EO5[view] [source] 2026-02-05 06:39:20
>>johnsp+(OP)
Is this Extism, but running as a service? https://extism.org/ It seems to me that a key feature of Extism is host functions (which can be called from the sandbox). But maybe I'm not comparing apples to apples?
◧◩
167. rdhyee+F37[view] [source] [discussion] 2026-02-05 16:13:23
>>simonw+Oe
Took this idea and ran with it using Fly's Sprites, inspired by Simon's https://simonwillison.net/2026/Feb/3/introducing-deno-sandbo.... Use case: Claude Code running in a sandboxed Sprite, making authenticated API calls via a Tokenizer proxy without credentials ever entering the sandbox.

Hit a snag: Sprites appear network-isolated from Fly's 6PN private mesh (fdf:: prefix inside the Sprite, not fdaa::; no .internal DNS). So a Tokenizer on a Fly Machine isn't directly reachable without public internet.

Asked on the Fly forum: https://community.fly.io/t/can-sprites-reach-internal-fly-se...

@tptacek's point upthread about controlling not just hosts but request structure is well taken - for AI agent sandboxing you'd want tight scoping on what the proxy will forward.

[go to top]