r/AlpineLinux • • Jun 15 '26

Browser sandboxing: flatpak vs bubblewrap vs VM + X11 Forwarding vs VM + vsock waypipe vs VM + spice / qxl

Hi,

I have been playing with the various ways we can sandbox web browsers.

Those are the options I see

- Flatpak

- Raw Bubblewrap

- Podman

- VM + X11 Forwarding

- VM + vsock + waypipe

- VM + spice / QXL

I currently use chromium under Flatpak but have also played with with raw bubblewrap which get quite complex quickly and can be a hit or miss.

Also I see that Flatpak is getting more and more dependent on systemd so it might not be a long term solution for us Alpine users?

I haven't looked into what are the trade-offs doing it with podman.

I am now looking into running a full VM dedicated to the web browser. In terms of perfs it might be viable since Alpine is so lightweight (even on the Intel N100 I am currently using). The approach would be similar to QubeOS I guess.

VM + X11 Forwarding via SSH works but the perf are a bit disappointing. I haven't tried going into optimizing it since Xorg might be less and less supported at the driver level, etc.

VM + vsock + waypipe is interesting.

From what I understand virtual sockets would offer the best performance to connect to the VM by enabling Virtio VSOCK for the VM and then running `socat VSOCK-LISTEN:1234,reuseaddr,fork TCP:localhost:1234` in the guest (since Alpine do not have the systemd socket activation thing builtin).

The communication works.

I am now trying to make waypipe works with vsock (https://gitlab.freedesktop.org/mstoeckl/waypipe/-/blob/v0.11.0/waypipe.scd?ref_type=tags#L260) but no success so far since I guess I need to run a headless compositor first.

I am wondering what the performance will be and maybe I won't be able to fully leverage the capabilities of graphical acceleration (OpenGL, vulkan, decoding, etc.) in the browser. I do not fully understand how wayland/waypipe works.

I also thought that exposing the memory of the vm directly in the host might be possible and have waypipe use it directly might be in theory possible but haven't dig deeper.

VM + spice/qxl

Also leveraging spice and running chromium in a kiosk compositor like cage might actually offer the best performance ? I haven't tried yet.

My questions are:

What are your thoughts on this?

If you tried the VM approach, what offered the best performance at the end?

Thanks !

13 Upvotes

17 comments sorted by

View all comments

Show parent comment

1

u/Qigong1019 Jun 18 '26

I think it's important to read on podman security and attacks and watch some youtubes on it. The system egress to the container is mostly read-only, but memory, process/dbus, audio, graphics, networking, is not infallible.

If you set your custom homepath, that is much better, and a major selling point. I cannot, in fact, access usb sticks instantly. You can bind mount system resources and reduce the plane, but that defeats the purpose. I think that security statement is more or less a liability waiver. Any containment system will need system resource access, be it dbus/polkit, memory, kernel. A big question with distrobox is how it works with DE. I personally don't know all of the hooks and gotchas.

A plain container is good for complete control over what uses system resources. For ex. networking only for a headless server. You have to look-see. To get gui apps running, don't re-invent the wheel. Distrobox will bind resources minimally, not everything. For ex, during creation on a systemd laptop, I still needed to add libpam-systemd to get a browser install, not even thinking about pipewire for audio or anything. So, it doesn't bind your entire init mgmt. It's a learning process, and you document your recipes.

My argument against docker : it runs a daemon, it wasn't rootless by default, it has a deep config, it is better purposed for professional container service. There are more chances to mess up.

Flatpaks. I really only consider it to protect the app install. I don't consider it to be highly sandboxed. For a browser, this is your least secure choice. Browsers use webgl. webrtc, contaminate your user homepath with cookies and opfs. It's not going to contain file creation, nor can you discretely dispose and rebuild quickly.

A VM as the best security option is still a performance issue. I could not daily drive that. Buy an Epyc. I don't use bubblewrap, so I don't have an opinion. I try and reduce hassle in my life. Once I get a new container crafted, imaged off, I'm good.