I have been trying to build an online java compiler. But running the clients code on server raises many security issues.
There are few I can think of – infinite loops, Restricted access to API, limiting memory usage, etc.
I have looked here and here. But I have a few more questions.
1) Restricted access to API is possible with the help of policy tool. But how do I check on memory and cpu usage(infinite loops,..)?
2) Policy Tool provides options to give permissions and not to restrict. So, if I choose, “Runtime permission” and getStacktrace as target then all others would be restricted?
You could use Ideone API. You have certain restrictions for a free account but it relieves you the burden of handling security and all.
It is available as a webservice and its WSDL can be found here: ideone.com/api/1/service.wsdl