Nick Coghlan added the comment:

I know ast.literal_eval() isn't enough - that's why I suggested the addition of 
ast.lookup_eval() in the opening post.

As far as your other suggestion goes, don't reinvent crypto badly - if you want 
to provide authentication support in listener(), provide a hook that allows the 
application to decide whether or not to accept the configuration before it gets 
applied. They can then choose there own authentication mechanism based on their 
own needs, and handle any appropriate security updates. Some will choose a 
simple shared secret, some may choose to require a cryptographic signature, 
some may pass the entire payload in an encrypted form.

However, this isn't an either/or situation - we can, and should, do both (i.e. 
provide a hook that allows the application to preauthenticate the configuration 
before it is applied, as well as replacing the use of eval() with something 
more limited like str.format lookup syntax). The right security mindset is to 
set up defence in depth, not trust one particular layer of defence to handle 
all possible varieties of attack.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15452>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to