I am currently developing an application in where a user will dynamically choose dlls and the application will execute some of the methods in that dll. (if you follow the first link, you will see that I am developing a sort of Robocode game application using the .Net Framework).
For example, when the battle starts, the run
method from the dll is executed.
Since whatever was specified in the run method will be executed, there are quite a bit of Security Constraints that have to be applied.
Like for example, if the user who programmed the dll, instead of using only the methods that are applicable from the interface (methods that the robot uses to walk and fire etc...), invokes methods that will retrieve files and maybe even delete files from the hard disk...and when another user loads that dll into his computer, those methods will be invoked on his pc and his files will be modified by this malicious code.
Thus, I need to somehow make this application run from a sort of Sandboxed Environment so that whatever methods are invoked, it will not affect the hard disk of the computer that the dll is opened on.
Any ideas on how I should start in doing this ?
Here is an example on how I am loading these dlls and invoking their methods:
for (int i = 0; i < robotList.Count; i++)
{
IRunnable o = robotList[i];
new Thread(delegate()
{
o.run();
}).Start();
}