bubblewrap icon indicating copy to clipboard operation
bubblewrap copied to clipboard

Add support for Landlock

Open arch-hash opened this issue 2 months ago • 2 comments

It would be great if Bubblewrap could integrate Landlock for path-based security restrictions inside the sandbox. Currently, Bubblewrap isolates processes using namespaces and mount points, but it lacks a mechanism to enforce more granular file access controls. Using Landlock, we can control access to specific paths (files/directories) within the sandbox for defense in-depth. Chromium's Sandbox2 now also uses landlock. Integrate Landlock after Bubblewrap sets up the sandbox environment (namespaces, mounts) and add a new CLI flag like --landlock-allow READ:/path/to/dir to specify access rules for files or directories.

arch-hash avatar Nov 14 '25 12:11 arch-hash

Duplicate of #690

rusty-snake avatar Nov 14 '25 15:11 rusty-snake

Specifically, see https://github.com/containers/bubblewrap/issues/690#issuecomment-2984526093.

Landlock is a mechanism, rather than a feature. It sounds as though the feature you are looking for is more like: having files/directories that exist inside the sandbox, but are inaccessible? Which doesn't immediately sound particularly useful.

However, one possible use of per-path access controls would be to bind-mount all of a directory (for example /dev) into a sandbox (so that for example hotplugged raw-HID devices work as expected, with them appearing and disappearing inside the sandbox), but prevent some of it from being accessed (for example allowing access to /dev/hidraw* but not /dev/video*). Something like that would be an example of a use-case for which Landlock is one possible implementation. Is this the sort of thing that you had in mind? Or if not that, then what?

I have very limited time for bubblewrap, so reviewing a mechanism that allows a concrete use-case like that to be solved would be a much higher priority for me than reviewing an abstract mechanism just floating around with no obvious purpose (or, worse, providing an alternative way to achieve something that can already be achieved differently).

I am unlikely to be able to implement this feature any time in the next few months/years (and if I did, the most likely result would be that it would be left waiting for reviews for an arbitrary length of time), but if there was a PR from someone else I'd try to review it.

smcv avatar Dec 03 '25 11:12 smcv