This is a top-level task to capture discussion surrounding sandboxing strategies for the Wikifunctions executor, which runs untrusted code from contributors (honeypot-as-a-service).
This discussion began on the #talk-sre Slack channel: https://wikimedia.slack.com/archives/CTFK3B423/p1691507756371529
Our top-level process is an Express service which needs certain permissions. In addition to receiving REST requests, it must delegate the execution of untrusted code to programming language interpreters (currently, just node and python, although we plan to support other languages in the future). It does this by spawning a subprocess.
Our goal is that the subprocess have far fewer rights than the top-level process. In particular, it should not be able to read or execute anything on the file system.
Solutions we have considered:
- WASM to run all programming language binaries (suggested originally here);
- LD_PRELOAD to intercept specific syscalls;
- seccomp to limit the permitted syscalls (if this is possible to implement at the process level);
- special sudo-er (would need special support in Blubber): we create a nobody user who can't do anything, and we give the runuser sudo power ONLY to call setuid(nobody)