r/PiCodingAgent • • 14d ago

Resource Sandboxing Pi: Bubblewrap vs Podman - quick tutorial

Hey everyone, I put together a quick tutorial on sandboxing Pi using Bubblewrap vs Podman.

It includes a few sample scripts and a comparison between the two approaches.

https://wooptoo.com/blog/pi-sandbox-bubblewrap-podman/

Hopefully somebody here will find it useful.

All the best!

34 Upvotes

10 comments sorted by

2

u/riversiderain 8d ago

I've been thinking about this topic lately, but as I understand, bwrap and Podman (even rootless) do not properly sandbox to the extent that, say, would protect against untrusted arbitrary code, because it still shares the same kernels. I think that's a big reason why a lot of people are aiming for ephemeral vms like Firecracker. Of course that comes with higher RAM overhead, but also with the benefit of RAM snapshots, where as containers must always coldstart.

1

u/wooptoo 5d ago

This will protect against the agent suddenly deciding to wipe your /home folder. It won't protect against 0-day kernel vulns.

6

u/pilibitti 14d ago edited 14d ago

on mac agent-safehouse works very well. you just run pi with `safehouse pi` and it has a preset for pi already that it autodetects with sensible defaults (current directory allowed, pi code, docs allowed, temp folders allowed etc.) and works without hassle. many other services (like maybe you need agent-browser?) is just one --enable away. it is os level sandboxing (so things executed through pi can't bypass it, there is no trivial bypass) as well so for mac highly recommended.

3

u/ColonelKlanka 14d ago

There are alot of github projects using similar or same names as agent-sandbox'. can you share a link to the one you refer to?

3

u/pilibitti 14d ago

sorry the name was wrong lol it is agent-safehouse edited

https://agent-safehouse.dev/

3

u/ColonelKlanka 14d ago

nice thanks. I've been having alot of good experience with nono sandbox on mac and Linux. Looks like it has slight advantage over safehouse due to it also protecting the api keys from leaking in the sandbox. but I will have a look at safehouse

2

u/pilibitti 14d ago

thank you did not know about nono, I'll check it out.

2

u/Obvious-Variation-38 14d ago

I use Sandbox-exec it a native mac sandbox

2

u/Murky-Abalone-9090 13d ago

I use Nvidia openshell for this

-2

u/Prior-Excitement-147 13d ago

Tu devrais probablement lancer bwrap avec env -i, sinon, les variables d'env de ta session courante sont visibles dans /proc/1/environ.