|
|
Log in / Subscribe / Register

Distributors entering Flatpakland

Distributors entering Flatpakland

Posted Jul 9, 2022 15:04 UTC (Sat) by smcv (subscriber, #53363)
In reply to: Distributors entering Flatpakland by pabs
Parent article: Distributors entering Flatpakland

It's not quite that simple. The way Flatpak manages to run useful apps, without giving them all so many permissions that the sandboxing is worthless, is that it uses portals to provide user-controlled access to resources outside the sandbox - but many portal interfaces need to know which app is talking to them (otherwise a malicious app could ask for more permissions while pretending to be Firefox), and the Linux kernel doesn't provide a great way to do that, particularly if you want to avoid security-significant race conditions (which of course we do).

For Snap, the portals rely on looking at the AppArmor LSM label, which requires snapd running as root with CAP_MAC_ADMIN to set up (no ability to run completely unprivileged like Flatpak can) and is not great at being cross-distro (works in Debian, Ubuntu and I think openSUSE by default, but won't work on SELinux distros like the Red Hat family, or on machines where AppArmor is on by default at the distro level but has been disabled locally).

For Flatpak, the portals rely on the fact that Flatpak sets up the app's mount namespace in a specific way, with a file /.flatpak-info describing which app this is, in a way that individual apps are not allowed to override.

It would be entirely possible to design a third set of conventions for how app identity works, teach the portals to look for those, and build a non-Flatpak convenience layer around bubblewrap that uses this third set of conventions - but nobody has done this yet, because the people doing the work are sufficiently happy with either Flatpak or one of the other frameworks that already exist.

bubblewrap is mechanism rather than policy, and is a relatively thin and user-unfriendly mechanism layer, because in some system configurations (notably, older Debian and older RHEL) it needs to be setuid root, making it important to minimize the amount of code in it to keep its attack surface small (Firejail is a sandboxing layer that does a lot more than bubblewrap, and it pays for this with the number of root privilege escalation CVEs in its history). If what you want is a non-Flatpak sandboxing mechanism based on bubblewrap, then you're going to need policy and convenience layers similar to the ones in Flatpak.


to post comments

Distributors entering Flatpakland

Posted Jul 9, 2022 15:25 UTC (Sat) by bluca (subscriber, #118303) [Link] (2 responses)

With systemd v251 most of the service sandboxing options are available for user units too (basically everything but things that deal with block/loop devices). I wonder how it would look if transient units were used instead of bubblewrap? The advantage would be uber process management thanks to cgroups. Just a thought experiment. If only I had infinite time...

Distributors entering Flatpakland

Posted Jul 10, 2022 10:15 UTC (Sun) by smcv (subscriber, #53363) [Link] (1 responses)

Again, replacing the use of bubblewrap is in many ways the easy part (it's quite a thin wrapper around kernel APIs); the hard part is everything else (in Flatpak itself and in the portals) that's been built around it.

Distributors entering Flatpakland

Posted Jul 10, 2022 10:31 UTC (Sun) by pabs (subscriber, #43278) [Link]

Could the hard parts be split out so they can be shared with other efforts?


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds