Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
f4777c63
Commit
f4777c63
authored
Mar 18, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/Restricted: allow os.urandom
parent
0972d806
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+1
-0
product/ERP5Type/tests/testRestrictedPythonSecurity.py
product/ERP5Type/tests/testRestrictedPythonSecurity.py
+12
-0
No files found.
product/ERP5Type/patches/Restricted.py
View file @
f4777c63
...
...
@@ -347,3 +347,4 @@ del member_id, member
from
random
import
SystemRandom
allow_type
(
SystemRandom
)
ModuleSecurityInfo
(
'os'
).
declarePublic
(
'urandom'
)
product/ERP5Type/tests/testRestrictedPythonSecurity.py
View file @
f4777c63
...
...
@@ -125,3 +125,15 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
def
testSystemRandom
(
self
):
self
.
createAndRunScript
(
'import random'
,
'return random.SystemRandom().getrandbits(10)'
)
def
test_os_urandom
(
self
):
self
.
createAndRunScript
(
'import os'
,
'return os.urandom(10)'
)
# other "unsafe" os members are not exposed
self
.
assertRaises
(
Unauthorized
,
self
.
createAndRunScript
,
'import os'
,
'return os.path.exists("/")'
)
self
.
assertRaises
(
Unauthorized
,
self
.
createAndRunScript
,
'import os'
,
'return os.system'
)
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