[Python-Dev] Sandboxing Python

Victor Stinner victor.stinner at gmail.com
Mon Mar 5 23:24:02 CET 2012


> Just forbid the sandboxed code from using the signal module, and set
> the signal to the default action (abort).

Ah yes, good idea. It may be an option because depending on the use
case, failing with abort is not always the best option.

The signal module is not allowed by the default policy.

>> Apply the timeout would require to modify the sum() function. A more
>> generic solution would be to use a subprocess.
>
> Maybe it would make more sense to add such a test to xrange()? (Maybe
> not every iteration but every 10 or 100 iterations.)

pysandbox may replace some functions by functions checking regulary
the timeout to raise a Python exception instead of aborting the
process.

Victor


More information about the Python-Dev mailing list