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
Labels
Merge Requests
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
e5be3a3a
Commit
e5be3a3a
authored
Jun 30, 2022
by
Valentin Benozillo
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testRestrictedPythonSecurity: Add ipaddress allowance test
parent
f4cb946f
Pipeline
#22652
failed with stage
in 0 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testRestrictedPythonSecurity.py
...rtal_components/test.erp5.testRestrictedPythonSecurity.py
+35
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testRestrictedPythonSecurity.py
View file @
e5be3a3a
...
@@ -770,6 +770,41 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
...
@@ -770,6 +770,41 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
'''
.
format
(
malicous_input
)
'''
.
format
(
malicous_input
)
)
)
def
testIpAddressModuleAllowance
(
self
):
# Test ipaddress usability
self
.
createAndRunScript
(
'import ipaddress'
)
self
.
createAndRunScript
(
'''
from ipaddress import ip_address
return ip_address(u'90.4.85.17').is_global
'''
)
self
.
createAndRunScript
(
'''
from ipaddress import ip_network
return ip_network(u'90.4.0.0/16').is_private
'''
)
self
.
createAndRunScript
(
'''
from ipaddress import ip_address, ip_network
return ip_address(u'90.4.85.17') in ip_network(u'90.4.0.0/16')
'''
)
self
.
createAndRunScript
(
'''
from ipaddress import ip_interface
return ip_interface(u'90.4.85.17').with_prefixlen
'''
)
self
.
createAndRunScript
(
'''
from ipaddress import ip_address
return ip_address(u'2a01:cb14:818:0:7312:e251:f251:ffbe').is_global
'''
)
self
.
createAndRunScript
(
'''
from ipaddress import ip_network
return ip_network(u'2a01:cb14:818:0:7312:e251:f251::/112').is_private
'''
)
self
.
createAndRunScript
(
'''
from ipaddress import ip_address, ip_network
return ip_address(u'2a01:cb14:818:0:7312:e251:f251:ffbe') in ip_network(u'2a01:cb14:818:0:7312:e251:f251::/112')
'''
)
self
.
createAndRunScript
(
'''
from ipaddress import ip_interface
return ip_interface(u'2a01:cb14:818:0:7312:e251:f251:ffbe').with_prefixlen
'''
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
Jérome Perrin
@jerome
mentioned in merge request
slapos.package!165 (merged)
·
Jul 13, 2022
mentioned in merge request
slapos.package!165 (merged)
mentioned in merge request slapos.package!165
Toggle commit list
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