Skip to content

Commit

Permalink
A bit more security just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
purplesyringa committed Sep 17, 2019
1 parent 1074877 commit 80efb3c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sandboxer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,14 @@ def handleNode(self, node, parent, scope):
# Add except handler
if isinstance(node, ast.ExceptHandler):
if node.name is not None:
node.name = "_exc"
node.body.insert(0, ast.Assign(
targets=[ast.Subscript(
value=ast.Name(id="scope%s" % scope, ctx=ast.Load()),
slice=ast.Index(value=ast.Str(s=node.name)),
ctx=ast.Store()
)],
value=ast.Name(id=node.name, ctx=ast.Load())
value=ast.Name(id="_exc", ctx=ast.Load())
))

# Now do something to prevent object.__subclasses__() hacks and others
Expand Down

0 comments on commit 80efb3c

Please sign in to comment.