[Python-Dev] pysandbox 1.5 released (original) (raw)

Victor Stinner victor.stinner at gmail.com
Tue Mar 20 13:32:43 CET 2012


pysandbox is a Python sandbox. By default, untrusted code executed in the sandbox cannot modify the environment (write a file, use print or import a module). But you can configure the sandbox to choose exactly which features are allowed or not, e.g. import sys module and read /etc/issue file.

http://pypi.python.org/pypi/pysandbox https://github.com/haypo/pysandbox/

Main changes since pysandbox 1.0.3:

pysandbox has known limitations:

It is recommanded to run untrusted code in a subprocess to workaround these limitations. pysandbox doesn't provide an helper yet.

pysandbox is used by an IRC bot (fschfsch) to evaluate a Python expression. The bot uses fork() and setrlimit() to limit memory and to implement a timeout.

https://github.com/haypo/pysandbox/wiki/fschfsch

--

The limitation on dict methods is required to deny the modification of the builtins dictionary. I proposed the PEP 416 (frozendict) but Guido van Rossum is going to reject it. I don't see how to fix this limitation without modifying CPython.

http://www.python.org/dev/peps/pep-0416/

Victor



More information about the Python-Dev mailing list