[Python-Dev] Challenge: Please break this! (a.k.a restricted mode revisited)
wes.turner at gmail.com
Mon Apr 11 21:52:10 EDT 2016
On Mon, Apr 11, 2016 at 8:08 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>
> Jon Ribbens wrote:
>> So far it looks like blocking "_*" and the frame object attributes
>> appears to be sufficient.
> Even if your sandbox as it currently exists is secure, it's
> only an extremely restricted subset. You seem to be assuming
> that if your technique works so far, then it can be extended
> to cover a larger subset, but I don't think that's certain.
How would you test that?
> One problem that's been raised is how to prevent untrusted
> code from monkeypatching imported modules. Possibly that
> could be addressed by giving the untrusted code a copy of
> the module, but I'm not entirely sure -- accidentally
> importing two copies of the same source file is a well-known
> source of bugs, after all.
- " Infinite recursion just segfaults for now."
* https://github.com/tobgu/pyrsistent #justfoundthis
- freeze, thaw
* define a @property (and no @propname.setter)
> A related, but more difficult problem is that if we allow
> the untrusted code to import any pure-Python classes, it
> will be able to monkeypatch them. So it seems like it will
> need its own copy of those classes as well --
> and having
> two copies of the same class around is *another* well
> known source of bugs.
One way to reduce the likelihood of this is to
bundle all dependencies into a self-contained
PEX ZIP package
and specify entry points.
> Python-Dev mailing list
> Python-Dev at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev