Commit 90f6823d by Jérome Perrin

patches/Restricted: allow random.SystemRandom

parent 110d9931
......@@ -344,3 +344,6 @@ for member_id in dir(decimal):
if isinstance(member, type) and issubclass(member, decimal.DecimalException):
ContainerAssertions[member] = 1
del member_id, member
from random import SystemRandom
allow_type(SystemRandom)
......@@ -123,3 +123,12 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
'return urlparse.parse_qsl("q=s")',
expected=[('q', 's')]
)
def testSystemRandom(self):
self.createAndRunScript('import random',
'return random.SystemRandom().getrandbits(10)')
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestRestrictedPythonSecurity))
return suite
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment