Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there like a native C Library? #626

Open
MarkusTieger opened this issue Apr 14, 2024 · 1 comment
Open

Is there like a native C Library? #626

MarkusTieger opened this issue Apr 14, 2024 · 1 comment

Comments

@MarkusTieger
Copy link

It would be great if there would be like a shared library for creating the sandbox. Otherwise i would have to spawn a child process for interacting with this software.

@smcv
Copy link
Collaborator

smcv commented Aug 6, 2024

No, there is not.

If you're doing what bubblewrap does (putting a child process in a sandbox), there's really no way to avoid having a child process: even if bubblewrap itself didn't need to be a child process, the sandboxed process would. You can't have half of your process be in one namespace and the other half be in another, that's just not possible.

If it's acceptable for your program to only work on systems that have access to unprivileged user namespaces, then you can do all the same things that bubblewrap does, from your own library code, if you want to: there's nothing magic about it. (For example, I think Chromium uses the same syscalls that bubblewrap does.)

On systems where the only reason that bubblewrap can do its job is by being setuid root, there is no way to get equivalent functionality from a library: your only option is to run the setuid binary as a child process, because only a setuid binary has the necessary privileges to be able to do bubblewrap's job.

Larger frameworks that run bubblewrap (such as Flatpak) generally have some utility code to construct a list of bubblewrap arguments: for example Flatpak's FlatpakBwrap and FlatpakExports would be a good starting point. There has been a vague idea for a while that "someone" should write a libbubblewrap to help with this, but none of the maintainers of bubblewrap have yet had the time available to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants