Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to execute sandboxed Java code?

I am trying to reproduce an API for executing Java (like ideone.com has), but so far I'm having a lot of difficulties running Java sandboxed (SELinux sandbox doesn't work).

I've heard about the SecurityManager, but I'm trying to figure out what's the easiest way to run Java code in a sandbox (kind of like a Java applet running in the browser), instead of writing my own jail server using the SecurityManager.

like image 468
Ron Reiter Avatar asked May 28 '13 08:05

Ron Reiter


2 Answers

You might want to take a look at the java-sandbox project [1] which aims at providing a simple interface to execute untrusted code.

[1] http://blog.datenwerke.net/p/the-java-sandbox.html

like image 182
Arno Mittelbach Avatar answered Sep 18 '22 18:09

Arno Mittelbach


The SecurityManager is designed for this purpose. You'll need to create a policy file to restrict access, as described here: Policy Files, then enable it at runtime for just the code you're trying to sandbox.

like image 22
Richard Wilkes Avatar answered Sep 20 '22 18:09

Richard Wilkes