Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Use secure module importer for the untrusted Pytho n expression.
Browse files Browse the repository at this point in the history
  • Loading branch information
malthe committed Jul 28, 2011
1 parent 39362e3 commit 126bb9a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/five/pt/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ class UntrustedPythonExpr(expressions.PythonExpr):
(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'
Expand Down

0 comments on commit 126bb9a

Please sign in to comment.