switch to realpath to check path traversal

This commit is contained in:
m957ymj75urz 2023-03-14 09:27:53 +01:00
parent b1294fa49f
commit 6daf9bb22c
1 changed files with 1 additions and 1 deletions

View File

@ -806,7 +806,7 @@ class SaveImage:
comfy_output_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output") comfy_output_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output")
full_output_folder = os.path.join(comfy_output_folder, subfolder) full_output_folder = os.path.join(comfy_output_folder, subfolder)
if os.path.commonpath((comfy_output_folder, os.path.abspath(full_output_folder))) != comfy_output_folder: if os.path.commonpath((comfy_output_folder, os.path.realpath(full_output_folder))) != comfy_output_folder:
print("Saving image outside the output folder is not allowed.") print("Saving image outside the output folder is not allowed.")
return return