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.

Restrict loading embeddings from embedding folders.

comfyanonymous434ce25ec007
diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py
index 9978b6c35..ffe2bd3bd 100644
--- a/comfy/sd1_clip.py
+++ b/comfy/sd1_clip.py
@@ -278,7 +278,13 @@ def load_embed(embedding_name, embedding_directory, embedding_size, embed_key=No
valid_file = None
for embed_dir in embedding_directory:
- embed_path = os.path.join(embed_dir, embedding_name)
+ embed_path = os.path.abspath(os.path.join(embed_dir, embedding_name))
+ embed_dir = os.path.abspath(embed_dir)
+ try:
+ if os.path.commonpath((embed_dir, embed_path)) != embed_dir:
+ continue
+ except:
+ continue
if not os.path.isfile(embed_path):
extensions = ['.safetensors', '.pt', '.bin']
for x in extensions: