A couple of tricks I use:
-
an apparmor profile tied to a shell script that wraps other commands .. it restricts read & write access to a scratch directory ... perfect for builds or one off scripts.
-
iptables rules & cgroups to restrict network access.. I have a setuid wrapper that drops privs again..
-
bwrap and mounting only what's necessary... quick to get going.
-
custom landlock wrapper, similar to apparmor but allows for quick userspace wrapping.
They can be combined too.