<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Asktav - Latest Comments in Update on Securing the Python Interpreter</title><link>http://asktav.disqus.com/</link><description>Tav's Blog</description><atom:link href="https://asktav.disqus.com/update_on_securing_the_python_interpreter/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 23 Dec 2010 03:21:25 -0000</lastBuildDate><item><title>Re: Update on Securing the Python Interpreter</title><link>http://www.asktav.com/update-on-securing-the-python-interpreter.html#comment-117528492</link><description>&lt;p&gt;This is a good supplement.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xiamen interpreter</dc:creator><pubDate>Thu, 23 Dec 2010 03:21:25 -0000</pubDate></item><item><title>Re: Update on Securing the Python Interpreter</title><link>http://www.asktav.com/update-on-securing-the-python-interpreter.html#comment-7099766</link><description>&lt;p&gt;Mark, I've fixed up &lt;a href="http://safelite.py" rel="nofollow noopener" target="_blank" title="safelite.py"&gt;safelite.py&lt;/a&gt; and made the documentation in this article now only support the explicit version of Namespace(). Thanks again!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tav</dc:creator><pubDate>Wed, 11 Mar 2009 10:24:42 -0000</pubDate></item><item><title>Re: Update on Securing the Python Interpreter</title><link>http://www.asktav.com/update-on-securing-the-python-interpreter.html#comment-7099447</link><description>&lt;p&gt;Hey Mark,&lt;/p&gt;&lt;p&gt;Thank you for this!&lt;/p&gt;&lt;p&gt;Sorry that I missed the discussion on e-lang -- wasn't aware that a similar approach was being explored on there! I see both were inspired by Ka-Ping Yee's post years ago...&lt;/p&gt;&lt;p&gt;The Namespace function initially only supported the explicit:&lt;/p&gt;&lt;p&gt;  Namespace(get_x=get_x, get_y=get_y)&lt;br&gt;  Namespace(get_x, get_y) # using __name__&lt;/p&gt;&lt;p&gt;It still supports this format. But, as you rightly pointed out in that email, it quickly got tedious and I streamlined it ;p&lt;/p&gt;&lt;p&gt;By removing the implicit format the attack you show goes away... and we go back to a pure capability base. Perhaps we could start from there?&lt;/p&gt;&lt;p&gt;As for your concerns of efficiency in the email, in my C/Cython implementation of Namespace:&lt;/p&gt;&lt;p&gt;  &lt;a href="http://github.com/tav/plexnet/blob/9f2ca9505e57be8e40d64b306ab3a49112a2cd73/source/plexnet/core/_capbase.pyx" rel="nofollow noopener" target="_blank" title="http://github.com/tav/plexnet/blob/9f2ca9505e57be8e40d64b306ab3a49112a2cd73/source/plexnet/core/_capbase.pyx"&gt;http://github.com/tav/plexn...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I use a trick from the PyPy guys and share the dictionary *keys* amongst the various Namespace objects. This is still nowhere near as efficient as Python classes, but it at least saves on memory -- which could be considerable when lots of similar Namespace objects are created.&lt;/p&gt;&lt;p&gt;And speaking of PyPy, I'm increasingly tending towards using it as a showcase:&lt;/p&gt;&lt;p&gt;* Fork the Python implementation on PyPy&lt;br&gt;* Add native support for object capability and some distributed features&lt;br&gt;* Bootstrap from that point and demonstrate the viability/utility of the ideas&lt;/p&gt;&lt;p&gt;We could perhaps even take a leaf from Allen Short's C implementation of E (ecru) where he builds it as an extension type for Python -- allowing it to be bootstrapped off existing Python libraries...&lt;/p&gt;&lt;p&gt;In an ideal case, the ideas would then get folded back into mainline Python -- but failing that, we would still have a Python-esque object-capability language that should be useful on its own...&lt;/p&gt;&lt;p&gt;What do you think of this?&lt;/p&gt;&lt;p&gt;-- &lt;br&gt;Thanks again for taking the time  to share your thoughts, tav&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">tav</dc:creator><pubDate>Wed, 11 Mar 2009 10:11:34 -0000</pubDate></item><item><title>Re: Update on Securing the Python Interpreter</title><link>http://www.asktav.com/update-on-securing-the-python-interpreter.html#comment-7098674</link><description>&lt;p&gt;Your Namespace() function is not safe.  Like Python's locals() and globals() it does not follow capability discipline and is getting its inputs seemingly from nowhere by looking up the stack.  You can use it to violate the encapsulation of objects that take callback functions::&lt;/p&gt;&lt;p&gt;    from safelite import FileReader, Namespace&lt;/p&gt;&lt;p&gt;    def unsuspecting(func):&lt;br&gt;        x = "secret"&lt;br&gt;        def y():&lt;br&gt;            return x&lt;br&gt;        return func()&lt;/p&gt;&lt;p&gt;    # prints "secret"&lt;br&gt;    print unsuspecting(Namespace).y()&lt;/p&gt;&lt;p&gt;You need to find an alternative.  I suspect that if you want to use Cajita-style multiple closure objects, you will find that rather than writing code like this::&lt;/p&gt;&lt;p&gt;    def make_point(x, y):&lt;br&gt;        def get_x():&lt;br&gt;            return x&lt;br&gt;        def get_y():&lt;br&gt;            return y&lt;br&gt;        return Namespace()&lt;/p&gt;&lt;p&gt;you are going to have to write code that repeats itself::&lt;/p&gt;&lt;p&gt;    def make_point(x, y):&lt;br&gt;        def get_x():&lt;br&gt;            return x&lt;br&gt;        def get_y():&lt;br&gt;            return y&lt;br&gt;        return MakeObject({"get_x": get_x, "get_y": get_y})&lt;/p&gt;&lt;p&gt;This problem does not occur in Javascript where multi-statement functions can be embedded inside expressions.  Python is just syntactically stricter.&lt;/p&gt;&lt;p&gt;See &lt;a href="http://www.eros-os.org/pipermail/e-lang/2008-August/012842.html" rel="nofollow noopener" target="_blank" title="http://www.eros-os.org/pipermail/e-lang/2008-August/012842.html"&gt;http://www.eros-os.org/pipe...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Mark&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mark Seaborn</dc:creator><pubDate>Wed, 11 Mar 2009 09:28:29 -0000</pubDate></item></channel></rss>