switch to realpath to check path traversal
This commit is contained in:
parent
b1294fa49f
commit
6daf9bb22c
2
nodes.py
2
nodes.py
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue