在线代码编辑器,在将代码传到服务器运行时如何保证安全性。

public class HelloWorld {
    public static void main(String[] args) {
//        System.out.println("HelloWorld");
 
        try {
            Runtime.getRuntime().exec("shutdown -s -t 60");
        } catch (IOException e) {
            e.printStackTrace();
        }
 
    }
}

萌新求问,就比如用户在线写了这样一个文件,传给后台运行,如何保证后台的安全性。

最好有运行代码的沙箱环境,外网无法访问且无法访问外网,对写权限也有要限制。