28 Commits
Author SHA1 Message Date
Alexopus bc798df250 Fix path traversal in ImageSaver output path/filename handling
`path` and `filename` are free-form strings that can come from a
workflow's JSON, not just a person typing into the local UI. Only the
final path segment was ever sanitized (make_pathname/sanitize_filename),
so a value like `../../../etc` or an absolute path could make
ImageSaver.save_images() create directories and write the image/JSON
sidecar outside ComfyUI's output directory (CWE-22/CWE-73). This is
what caused v1.24.0 to be banned on the Comfy Registry
(Comfy-Org/registry-backend#206).

Add utils.resolve_within_output(), which joins path pieces onto
folder_paths.output_directory, resolves symlinks, and rejects the
result if it escapes that directory. Apply it everywhere
ImageSaver.save_images() turns `path`/`filename` into a filesystem
path: the output directory itself, the final image target, and the
optional workflow-JSON sidecar. Nested relative subfolders (e.g.
`portraits/2026-08-27`) still work; `..`, absolute paths, and
symlink escapes are now rejected before anything is created.

Covered by a new tests/ suite (tests/test_paths.py), since exercising
nodes.py requires stubbing ComfyUI's runtime (see tests/conftest.py).

Fixes alexopus/ComfyUI-Image-Saver#138
2026-08-27 20:52:13 +02:00
ComplexRobot 980c80d24c Full refactor of file matching. Code consolidation into core functions. 2025-08-27 18:36:08 +02:00
ComplexRobot 3d9f98609d Add fallbacks to just name checks. 2025-08-27 18:36:08 +02:00
ComplexRobot edea2dd52b Fix endswith filename collision error. 2025-08-27 18:36:08 +02:00
Alexopus 6b6789e84a Case-insensitive extension check for checkpoints 2025-08-24 17:39:28 +02:00
Alexopus f367d2860b Consider gguf model and locations when hashing models 2025-08-24 17:39:28 +02:00
Alexopus 98e7dbd619 Remove slashes from filename sanitization 2025-08-11 14:36:40 +02:00
Alexopus 968e5d620c Sanitize filenames and allow custom info to be added to metadata 2025-08-10 10:01:47 +02:00
Edward Johan fef1b2a6be Simplified network request 2025-08-02 18:50:44 +02:00
Edward Johan 87ff99cdbb Fixed timeout exception to prevent network timeout crashes
I noticed that `except TimeoutError:` doesn't get triggered for `response.get()` function, so replaced it with `except requests.exceptions.Timeout:`.
2025-08-02 18:50:44 +02:00
Alexopus 8a260b9729 Enable Simple+Metadata 2025-06-09 14:16:32 +02:00
Alexopus cec0846b2d Add some type hints 2025-06-09 14:16:32 +02:00
Alexopus 80c5e99c95 Do not override proxy settings of requests.get 2025-05-05 10:40:57 +02:00
Edward Johan 596aae64c3 Update utils.py 2025-05-01 21:35:36 +02:00
Alexopus acd5da3cc5 Refactor civitai utils 2025-04-27 10:21:53 +02:00
Alexopus b7c27b178a add full_checkpoint_path_for util 2025-04-25 12:51:29 +02:00
ComplexRobot 95aaeb9a9d Cleaner output for sha256 progress bar. 2025-03-21 11:31:33 +01:00
Alexopus 2ea20ec8ae Better console output 2025-03-21 09:36:01 +01:00
ComplexRobot ac9f15c0c9 Use cleaner with statement to close the progress bar. 2025-03-21 09:36:01 +01:00
ComplexRobot 9b4a421c40 Add close() to progress bar. 2025-03-21 09:36:01 +01:00
ComplexRobot 0335ac62a9 Add progress bar for sha256 calculation. 2025-03-21 09:36:01 +01:00
Alexopus 93bbdb9eff Fix extension check in full_lora_path_for 2024-01-14 13:38:36 +01:00
Alexopus 8c4ba25260 typo 2024-01-10 19:27:48 +01:00
Alexopus 002471d950 Try to find loras with incomplete paths 2024-01-10 19:23:04 +01:00
nickve28 985969f983 replace AnyStr with str 2024-01-04 19:43:59 +01:00
nickve28 da6e3cfbe7 have consistent file endings 2024-01-04 18:35:55 +01:00
nickve28 707083a7a6 Several refactors
- Move the generic functions to utils
- Make prompt meta extractor comfy independent
- document functions
2024-01-04 18:35:55 +01:00
nickve28 54f2fd7a86 start on extracting embedding information and lora info 2024-01-04 18:35:55 +01:00