The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Properly check upload filename for directory transversal.
comfyanonymousd6d1a8998fa6
diff --git a/server.py b/server.pyindex 2ebf9e235..e58a11d86 100644--- a/server.py+++ b/server.py@@ -170,15 +170,15 @@ class PromptServer():subfolder = post.get("subfolder", "")full_output_folder = os.path.join(upload_dir, os.path.normpath(subfolder))+ filepath = os.path.join(full_output_folder, filename)- if os.path.commonpath((upload_dir, os.path.abspath(full_output_folder))) != upload_dir:+ if os.path.commonpath((upload_dir, os.path.abspath(filepath))) != upload_dir:return web.Response(status=400)if not os.path.exists(full_output_folder):os.makedirs(full_output_folder)split = os.path.splitext(filename)- filepath = os.path.join(full_output_folder, filename)if overwrite is not None and (overwrite == "true" or overwrite == "1"):pass