Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

switch to realpath to check path traversal

m957ymj75urz6daf9bb22c6b
diff --git a/nodes.py b/nodes.py
index dbbe9eba7..e7c212c8d 100644
--- a/nodes.py
+++ b/nodes.py
@@ -806,7 +806,7 @@ class SaveImage:
comfy_output_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output")
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.")
return