I'm looking into implementing a system wherein users are able to pass scripts to our server and have them executed. Thankfully there are plenty of resources for Embedding Python into C#. However I am mostly worried about users passing scripts that access system functions and cause undesirable or even malicious results. Main example being: Writing to files on the server unrestricted.
I've been searching for a good way to completely limit a script's access to strictly just the framework classes that we offer clients but most of the hits that I find are basically "here's how you embed a script interpreter in C#" but never mentions any safety concerns like limiting access. Admittedly I could do an initial pass over the script and search for any blacklisted code but there is always the chance to miss something.
There's no requirement about which language gets executed, preferably something that can be compiled ahead of time. The server will be running C# to answer requests and delegating some to the user created code. I'm just having trouble finding any method with any language that limits access from user made code.