mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge branch '2.2' into 3.0
# Conflicts: # gns3server/compute/base_manager.py # gns3server/handlers/api/compute/dynamips_vm_handler.py # gns3server/handlers/api/compute/iou_handler.py # gns3server/handlers/api/compute/project_handler.py # gns3server/handlers/api/compute/qemu_handler.py # gns3server/handlers/api/controller/node_handler.py # gns3server/handlers/api/controller/project_handler.py # gns3server/handlers/index_handler.py # tests/handlers/api/compute/test_project.py # tests/handlers/api/compute/test_qemu.py # tests/handlers/api/controller/test_node.py # tests/handlers/api/controller/test_project.py
This commit is contained in:
commit
09ac7fd7fb
12 files changed
+599
-3
No files matched your search
@@ -37,6 +37,17 @@ def get_default_project_directory():
|
||||
return path
|
||||
|
||||
|
||||
def is_safe_path(file_path, directory):
|
||||
"""
|
||||
Check that file path is safe.
|
||||
(the file is stored inside directory or one of its sub-directory)
|
||||
"""
|
||||
|
||||
requested_path = os.path.abspath(file_path)
|
||||
common_prefix = os.path.commonprefix([requested_path, directory])
|
||||
return common_prefix != directory
|
||||
|
||||
|
||||
def check_path_allowed(path):
|
||||
"""
|
||||
If the server is non local raise an error if
|
||||
|
||||
Reference in new issue
Block a user