[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame web plugin




On Sep 7, 2008, at 10:49 AM, Campbell Barton wrote:

Im still a bit at a loss as to where the blocking problem is...

if I was to sandbox cpython for a pygame heres what Id try.

- replace builtins like import, compile, exec, reload  through the C
api (as with the blender3d example I posted earlier, scripters will
need to write scripts accounting for this perhaps in one py file to
start with.
- try to replace pythons memory allocator with one that can be
limited.. OR, patch python to limit the memory it can use. (web plugin
could statically link the patched python) OR use process some OS
control to limit memory management.

What else would you need to do to sandbox python for a web plugin?

As with all security since the dawn of time, blacklisting the bad is not an acceptable solution. You need to whitelist only the allowed operations. That approach really doesn't work in CPython. As I said, if you think it is easy, you don't understand.

--Noah