I am planning to offer a free multi-hosting for a rack-based ruby framework using nginx and passenger to serve these apps. I am working on several options and I would like to ask some advice on the best security practices for this type of setup in a multi hosting environment:
The first option I am working on is a web-based front-end which will allow users to upload their application. To make it fairly automated I could build a parser to check that the ruby/framework code doesn't contain any malicious command e.g. %x( and others too. I am not sure if it is really possible to cover all possibility but this should be mitigated by the fact that, upon upload, a unix user is created (together with a nginx sub domain) and the uploaded app will run inside the user directory and that user has no special server wide permissions outside his own directory;
The second option is to allow sftp access (or sftp/ssh access) with essentially no permissions outside their directory. In this case a screening of member will have to be implemented (subscription form) but would potentially give more flexibility.
From your experience what would be the most suitable option? Secondly for option 2 with sftp or even sftp and ssh access that would be an appropriate security setup? bear in mind that nginx would need read access in the whole /users/.... tree so it can't be too restrictive. Thanks in advance for your advice!