[issue15452] Eliminate the use of eval() in the logging config implementation
report at bugs.python.org
Sun Jul 29 06:32:01 CEST 2012
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 <report at bugs.python.org>
More information about the Python-bugs-list