Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
666315e1
Commit
666315e1
authored
Nov 06, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not allow import-as to rebind "under names".
parent
9579eb05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
lib/python/RestrictedPython/RestrictionMutator.py
lib/python/RestrictedPython/RestrictionMutator.py
+8
-1
lib/python/RestrictedPython/tests/security_in_syntax.py
lib/python/RestrictedPython/tests/security_in_syntax.py
+10
-0
No files found.
lib/python/RestrictedPython/RestrictionMutator.py
View file @
666315e1
...
...
@@ -15,7 +15,7 @@ RestrictionMutator modifies a tree produced by
compiler.transformer.Transformer, restricting and enhancing the
code in various ways before sending it to pycodegen.
'''
__version__
=
'$Revision: 1.1
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
from
SelectCompiler
import
ast
,
parse
,
OP_ASSIGN
,
OP_DELETE
,
OP_APPLY
...
...
@@ -271,3 +271,10 @@ class RestrictionMutator:
def
visitAugAssign
(
self
,
node
,
walker
):
node
.
node
.
in_aug_assign
=
1
return
walker
.
defaultVisitNode
(
node
)
def
visitImport
(
self
,
node
,
walker
):
for
name
,
asname
in
node
.
names
:
self
.
checkName
(
node
,
name
)
if
asname
:
self
.
checkName
(
node
,
asname
)
return
node
lib/python/RestrictedPython/tests/security_in_syntax.py
View file @
666315e1
...
...
@@ -30,3 +30,13 @@ def bad_attr():
def
no_exec
():
exec
'q = 1'
def
no_yield
():
yield
42
def
check_getattr_in_lambda
(
arg
=
lambda
_getattr
=
(
lambda
ob
,
name
:
name
):
_getattr
):
42
def
import_as_bad_name
():
import
os
as
_leading_underscore
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment