I'm building an application that will enable users to write code from the browser. Once the code is written I save the contents to my webserver in a user-specific folder.
I'd also like to add a feature whereby the user can run the code in the language of their choice: ruby, python, etc...
Obviously I don't want to just run the code 'as is' since the user may have dangerous code which may delete sensitive files from the webserver.
How can I architect a secure system where each user would have their own custom environment to run the code they have written, in the language of their preference?