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:
grossmj
2021-05-15 20:46:34 +09:30
12 changed files with 599 additions and 3 deletions

View File

@ -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