Do other languages have a security model for this? I've always assumed that building arbitrary code could execute something in most languages.
I think using something like the pledge syscall from OpenBSD in the compiler could be useful. That way, it's controlled at the process level which things can be accessed on the system.