16 Commits
Author SHA1 Message Date
rubz bad9f72000 Remove all routes and process launches, approve folders via ComfyUI settings (1.1.5)
The registry scan report on 1.1.4 listed exactly three findings, all of them
the folder-dialog process launches in __init__.py (yara rule
python_command_injection_risk, severity "info"), and no path-traversal
findings at all: the 1.1.4 containment guard did its job. An admin escalated
1.1.2, 1.1.3 and 1.1.4 from Flagged to Banned on those three hits anyway.

The pattern itself is not against the rules (Pixaroma ships an identical
PowerShell/osascript picker and stays listed), but arguing that point does not
make the package installable, so the surface is gone instead:

- __init__.py registers no HTTP route and launches no process. The Browse
  button and POST /craftkit/browse_folder are removed.
- Folder approval moved to ComfyUI's own settings store under
  CraftKit.AllowedFolders. The node button writes it through the frontend
  settings API; Python only ever reads the file.
- craftkit_folder_guard.py drops remember_folder/dialog_available and the
  allow_any flag, so containment can no longer be disabled at all. The legacy
  allowed_folders.json is still read so folders approved with the old dialog
  keep working.
- Comments avoid naming the module and call form the scanner matches, since
  the scan reads source text.

Verified against a simulated install (10/10 cases) and end to end in ComfyUI:
button approves, Python accepts the folder and its subfolders, pre-update
approvals still work, system folders and .. traversal still refused.
2026-09-07 21:22:14 +02:00
rubz dca216b0a2 Confine SmartBatchResize's input_folder to approved folders (1.1.4)
The registry's HIGH-severity finding was never the COM/folder-picker code
we suspected in 1.1.1-1.1.3 — it's smart_batch_resize.py's input_folder
widget accepting any path and writing to it, an unconfined filesystem
write reachable via unauthenticated POST /prompt. Found via the
undocumented ?include_status_reason=true parameter on the versions API.

Adds craftkit_folder_guard.py (pattern adapted from Pixaroma's
_path_guard.py): a folder is only usable if it's inside ComfyUI's own
input/output/temp directories, or the user picked it in the native OS
folder dialog at some point (the click-OK happens outside anything a
request can reach), or allow_any is hand-edited into the config.

Also fixes a PowerShell console window flashing open behind the folder
dialog (missing CREATE_NO_WINDOW).
2026-08-31 13:52:04 +02:00
rubz 97ddb0af92 fix: replace Windows folder-picker COM/IFileDialog interop with FolderBrowserDialog, bump to 1.1.3
Comfy Registry flagged 1.1.2, likely on the inline Add-Type C# compilation
and raw ComImport/Marshal COM interop used for the native folder dialog —
that pattern reads as COM-hijack-style code to automated security scanners.
Swapped for the plain System.Windows.Forms.FolderBrowserDialog (no dynamic
code compilation, no COM interop), preferring pwsh (modern Explorer-style
look) and falling back to powershell.exe (classic tree-view) when pwsh
isn't installed.
2026-08-31 01:54:10 +02:00
rubz 3b7ee60a8b Add macOS/Linux support to browse_folder folder picker
Windows kept its existing IFileDialog implementation; macOS uses
osascript, Linux tries zenity then falls back to kdialog. Fails open
(empty string, no crash) if no picker is available, matching the
existing Windows behavior.
2026-08-30 11:08:20 +02:00
rubz f695c67ff1 chore: tighten error handling and dedupe a magic string from the nitpick pass
- Narrow the ProgressBar import guard to ImportError only, with a comment explaining why it stays (the module is imported standalone by the test suite outside a live ComfyUI)
- Extract the CRAFTKIT_DIALOG_ERROR: sentinel into a shared constant instead of three separate literals, use str.removeprefix
- Note that .avif/.heic can also fail on re-encode (with output_format=keep_source), not just decode
2026-07-27 21:51:08 +02:00
rubz 50af1e743d fix: nitpick cleanups from code review (N-23 through N-32)
- os module imported properly instead of __import__("os")
- browse_folder distinguishes a real COM/dialog failure from a user cancel
- fix Marshal.PtrToStringUni + leak-safe cleanup in the folder-picker COM call
- lock browse_folder so two concurrent clicks can't open two dialogs
- drop redundant int(round()) in SmartResolutionMultiplier
- unify "CraftKit —" docstring prefix across nodes
- comment OUTPUT_NODE=True on the status-label nodes so it isn't "cleaned up" later
- add .jfif/.avif/.heic to SmartBatchResize's supported extensions, document non-recursive scanning
- add a progress bar to SmartBatchResize (degrades gracefully outside a live ComfyUI)
- add readme/requires-python and a dependency-rationale comment to pyproject.toml
2026-07-27 21:40:18 +02:00
rubz c6f6914488 fix: batch collapse, memory blowup, resize rounding, and 8 more Should-Fix issues from code review
- Reject use_original_name=False + use_counter=False (all files collapsed to one output name)
- Add preview_limit to cap in-memory preview tensors (was holding entire batch as float32)
- Recover from per-file failures instead of aborting the whole batch
- Fix _calc_new_size overshoot past longest_side and off-by-one truncation
- Add upscale_if_smaller to SmartBatchResize to match SmartResize
- Clip pixel values before uint8 cast (was wrapping on overflow)
- Support CUDA tensors and RGBA/grayscale images in SmartResize
- Handle empty batches; derive width/height from the actual output tensor
- Require POST + loopback/origin check on the browse_folder endpoint (CSRF)
- Add subprocess timeout to the folder picker dialog
- Isolate the browse_folder route registration so import failures don't take down all nodes
- Validate folder_custom against path traversal and self-overwrite
- Replace IS_CHANGED=NaN with a folder-listing hash so unrelated graph runs can still cache
2026-07-27 18:42:54 +02:00
rubz c0609cfc85 add Smart Profile Switch, fix folder picker, README overhaul, v1.0.2
- rename Smart Category Config → Smart Profile Switch 🧩 (code, JS, locales, demo workflow)
- add banner.svg and embed it at the top of README
- replace fragile OpenFileDialog folder-browse hack with native IFileDialog/FOS_PICKFOLDERS picker — fixes wrong-folder bug on single-click select
- flip Smart Resize's upscale_if_smaller default to true — node now resizes to target by default, as the name implies
- add width/height source tooltip to Smart Resolution Multiplier's image input
- fix stale widgets_values in smart_batch_resize_demo.json (10 fields → 13 after prefix/counter fields were added)
- full README rewrite: correct inputs/defaults/outputs for all 5 nodes, new Smart Profile Switch section, Example workflows section, expanded "Why these nodes?"
- add new example workflow (seedvr2_smartresize_demo.json), updated screenshots
- add assets/*.ai to .gitignore
- bump version to 1.0.2
2026-07-01 12:33:32 +02:00
rubz 9bf268bf1b Add Browse folder button + longest_side presets to Smart Batch Resize
- Browse folder button: native Windows folder picker via PowerShell
  (TopMost owner form + OpenFileDialog for modern Explorer view)
- longest_side preset chips (512/768/1024/1536) drawn on canvas,
  active preset highlighted
- Reorder inputs into logical groups (input → resize → naming → folder → options)
- README: describe Smart Batch Resize disk-save / filename-preservation behaviour
2026-06-29 22:02:37 +02:00
rubz 32c8c85bd5 fixed dreadme images en renaming 2026-03-23 01:11:42 +01:00
rubz 6a47c67c25 rebranded en updated prompt controler 2026-03-22 23:06:30 +01:00
rubz dd70f0b118 4 nodes 2026-03-22 00:29:53 +01:00
rubz c8ce133fad commit 2026-03-22 00:29:25 +01:00
rubz 2421ffd343 updated init correct 2026-03-22 00:26:05 +01:00
rubz addba92a81 added a node: smart_batch_controller.py 2026-03-22 00:18:46 +01:00
rubz aa2e2bd16c uploaded SmartResize nodes 2026-03-03 12:13:32 +01:00