Executing untrusted scripts in a sandboxed environment
maniandram01 at gmail.com
Sat Oct 6 11:11:54 CEST 2012
On Saturday, 6 October 2012 04:00:08 UTC+5:30, Robin Krahl wrote:
> Hi all,
> I need to execute untrusted scripts in my Python application. To avoid security issues, I want to use a sandboxed environment. This means that the script authors have no access to the file system. They may only access objects, modules and classes that are "flagged" or "approved" for scripting.
> I read that I will not be able to do this with Python scripts. (See SandboxedPython page in the Python wiki  and several SE.com questions, e. g. .) So my question is: What is the best way to "embed" a script engine in a sandboxed environment that has access to the Python modules and classes that I provide?
> Thanks for your help.
> Best regards,
>  http://wiki.python.org/moin/SandboxedPython
>  http://stackoverflow.com/questions/3068139/how-can-i-sandbox-python-in-pure-python
"The Java and CLR/.NET runtimes support restricted execution, and these can be utilised through the Jython and IronPython variants of Python (as well as by other languages, obviously)."
You can also check out http://doc.pypy.org/en/latest/sandbox.html for PyPy's sandbox
More information about the Python-list