[Checkins] SVN: five.pt/trunk/src/five/pt/expressions.py Use secure module importer for the untrusted Pytho n expression.

Malthe Borch mborch at gmail.com
Thu Jul 28 15:33:21 EDT 2011


Log message for revision 122405:
  Use secure module importer for the untrusted Pytho n expression.

Changed:
  U   five.pt/trunk/src/five/pt/expressions.py

-=-
Modified: five.pt/trunk/src/five/pt/expressions.py
===================================================================
--- five.pt/trunk/src/five/pt/expressions.py	2011-07-28 19:19:50 UTC (rev 122404)
+++ five.pt/trunk/src/five/pt/expressions.py	2011-07-28 19:33:21 UTC (rev 122405)
@@ -214,6 +214,9 @@
         (name, static(builtin)) for (name, builtin) in utility_builtins.items()
         ))
 
+    builtins['modules'] = template("cls()", cls=Symbol(
+        ZRPythonExpr._SecureModuleImporter), mode="eval")
+
     def rewrite(self, node):
         if node.id == 'repeat':
             node.id = 'wrapped_repeat'



More information about the checkins mailing list