Wasm is one of the best solutions for running untrusted code. Alternative are more complicated or have limited language choices.