News for hackers. Stuff that matters.
Re:Firejail: Linux namespaces and seccomp-bpf sandbox by the8472 on Tuesday March 29, 2022 @12:35PM (#30844818)
With sandboxing of the bubblewrap or firejail flavor you have one externally applied ruleset to a tree of processes. This ruleset must be lax because it is the union of all the permissions the processes may need at any time and on any execution path. This is bad because it makes your sandbox more permissive than necessary and specific points in time for specific processes

pledge on the other hand allows a process to gradually drop privileges as it goes down different code paths. E.g. it could initially retain permissions to open files and enumerate directories because it has an option to do things recursively. But after checking arguments and no recursive option was requested it just opens a fixed list of files and then drops those caps. But it's a fancy tool (like ripgrep) that might spawn helper programs to parse the content and those may still have to open files on their own. So just because it locally dropped its own capability to open files (but retained the cap to spawn processes) doesn't mean its child processes should inherit that restriction, they can lock themselves down. It can still choose to impose separate restrictions on child processes externally, but that's orthogonal to the self-restrictions.

This makes things more composable and allows for tighter sandboxing after program init.

Re:Firejail: Linux namespaces and seccomp-bpf sandbox by staticassertion on Wednesday March 30, 2022 @02:35PM (#30859055)
Oh, I wasn't thinking of firejail, I was thinking about programs sandboxing themselves via seccomp.
Re:Firejail: Linux namespaces and seccomp-bpf sandbox by staticassertion on Wednesday March 30, 2022 @05:02PM (#30860717)
edit: or landlock
Re:Firejail: Linux namespaces and seccomp-bpf sandbox by the8472 on Thursday March 31, 2022 @12:17PM (#30868907)
Even with self-sandboxing filters that won't be inherited can be made more tight than the inherited ones. Maybe you could fork a spawn helper at program startup before installing the filters to emulate this behavior, but that makes IPC more complicated.