https://man.openbsd.org/pledge.2
It's objectively the right model, if my assumptions are wrong, the program fails. I like that.
Maybe it could be taken further... to lie to the app and report back about it's sandbox... or halt and log it's image.
https://man.openbsd.org/pledge.2
It's objectively the right model, if my assumptions are wrong, the program fails. I like that.
Maybe it could be taken further... to lie to the app and report back about it's sandbox... or halt and log it's image.
In fact, your wish list highlights the problems of pledge precisely. You can implement "pretend to succeed" and "dump core for inspection by a trusted supervisor", but only on Linux with seccomp-bpf, not with pledge.
Flexible sandboxes don't help if your programs don't run in them.
Pledge is simple, and that helps people adopt it and start using it. When most operating systems are providing something equivalent and most programs are making some use of it, it then becomes a selling point to do it better, because the status quo has moved. At that point, pledge might not compare well, unless it has evolved.
I'm using my computer right now. And pledge is evolving over time, as we gain experience in what real programs need by implementing protection for them.
https://wiki.mozilla.org/Security/Sandbox/Seccomp
I would like much more general control, like disable write, or prevent forks, or net access, right from the executing shell. I have selinux experience, and it's too low level.
The problem is that seccomp, as far as I'm aware, does not provide you with easy access to the actual arguments of system calls if they are not pointers. The actual pointed-at values of the arguments are required for emulating pledge.
But at least unveil can be implemented via mount namespaces.
The main usecase for this is container runtimes (emulating privileged operations like auto-loading of kernel modules), but it could also be used for this an a whole host of other really neat features.
(Huge shout-outs to Tycho Anderson for working on this for quite a while!)