[Python-Dev] Some news from my sandbox project (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Sep 19 14:08:04 CEST 2010


On Sun, 19 Sep 2010 12:19:44 +0200 Victor Stinner <victor.stinner at haypocalc.com> wrote:

Le dimanche 19 septembre 2010 01:05:45, Greg Ewing a écrit : > I don't follow. Trusted functions such as proxy() shouldn't > be sharing a builtins dict with sandboxed code. > (...) > So give each program its own copy of builtins.

By "program" you mean a "process"? proxy() and untrusted functions are executed in the same process and the same interpreter. Untrusted code calls (indrectly) proxy(): should I create a new copy of builtins for each frame? I don't know how to do that in Python (without modify the Python interpreter) and I suppose that it will make Python slower.

def f(): return oct ... f() import types m = types.ModuleType("my builtins") m.dict.update(builtins.dict) m.oct = 3 f.globals['builtins'] = m f() 3

Regards

Antoine.



More information about the Python-Dev mailing list