[PR #3298] [MERGED] v3: Restrict Flagged CNR installs on non-local listeners #3173

Closed
opened 2026-10-28 21:15:49 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/ComfyUI-Manager/pull/3298
Author: @ltdrdata
Created: 9/18/2026
Status: ✅ Merged
Merged: 9/18/2026
Merged by: @ltdrdata

Base: main ← Head: feat/v3-flagged-policy


📝 Commits (1)

  • 1796c72 Restrict flagged CNR installs on non-local listeners

📊 Changes

10 files changed (+1004 additions, -91 deletions)

View changed files

📝 README.md (+45 -0)
📝 glob/cnr_utils.py (+2 -1)
📝 glob/manager_core.py (+138 -68)
📝 glob/manager_server.py (+19 -10)
📝 glob/manager_util.py (+47 -1)
📝 prestartup_script.py (+21 -3)
➕ tests/e2e/test_e2e_flagged_nodepacks.py (+400 -0)
➕ tests/test_flagged_nodepack_policy.py (+325 -0)
📝 tests/test_install_flags_gates.py (+3 -3)
📝 tests/test_write_config_persistence.py (+4 -5)

📄 Description

Purpose and scope

A successful Registry install response previously allowed a Flagged CNR version to proceed. Require Flagged versions to satisfy the same installation conditions as Active versions, plus a server listening exclusively on loopback or an explicit administrator override. Covers installation, reinstallation, switching, updates, deferred startup and server-scheduled restores.

The allow_flagged_nodepack_install option belongs in config.ini’s [default] section. It defaults to false; only case-insensitive true enables it, after restarting ComfyUI. The override is intended for a trusted private network and permits non-loopback listeners. It does not detect private networks or bypass common security checks, Registry refusals or Git/pip restrictions. Active and Pending installation behavior is retained.

Key changes

  • Use status from the existing CNR install response. Check policy before changing the current pack and reuse that response for execution, without another Registry lookup.
  • Validate reinstallation before removal, then install and rerun the pack’s script. Preserve files and activation state on denial, retain the reason in queue/update results and avoid retrying rejected restore targets.
  • Recheck deferred work against current startup settings and pass the resolved server permission to scheduled restore children. Standalone CLI retains its existing interface and local administrator behavior.
  • Show a short security-configuration denial in the UI. Only terminal logs provide the loopback listener and private-network override remedies, including restart instructions.

Affected modules: CNR metadata mapping, installation core, server queues, startup processing, configuration and README. Deferred switches use stored status without refreshing it from the Registry. Older reservations without status require loopback-only listeners or the override; otherwise startup rejects them without changing the pack and tells the user to request installation again. Enabling an already installed identical version remains a local activation with no Registry lookup or installation script.

Validation approach

Core tests run production installation paths with controlled external responses. Server E2E uses real HTTP requests, queues, ZIP installation, restart and CLI subprocesses, with a local Registry and isolated paths, settings and databases. Live Chromium scenarios also exercise the combined UI through real routes and WebSocket completion.

Intent Observed result
Add restrictions only to Flagged Active/Pending controls install; Flagged needs loopback or override. Strong-security controls reject both Active and Flagged before metadata lookup.
Preserve state on denial Existing files, versions and activation state survive; no download or reservation is created.
Avoid duplicate lookups Count metadata requests through installation and restore; deferred switches make no additional lookup.
Preserve execution context Check immediate/deferred execution, old reservations, callback timing, standalone CLI behavior and actual server-scheduled restore children. Existing-version activation requires no Registry lookup or installation script.
Keep errors and settings correct Verify short UI errors versus terminal remedies, Registry refusal, listener edge cases and preservation of an administrator's option during an unrelated UI save.

Tests fail when status propagation or reinstall script execution is deliberately removed, and pass when restored. Allowed installation controls also pass.

Validation results

Scope Result
Standalone 1796c72f, non-E2E regression 89 passed; 22 subtests passed
UI + Flagged integration cc3d1001, non-E2E regression 235 passed; 221 subtests passed
Policy server E2E on the final production files 60 passed; 6 skipped
Live browser E2E on the final production files 7 scenarios passed; no uncaught browser exceptions

The six policy E2E skips require a preinstalled pack under strong security. Strong-security denial is tested directly. The full policy suite passed when run alone after an initial parallel run encountered a test-server port collision. No product code or assertions were changed to address that fixture collision.

Snapshot checks establish admission, extraction and denial-state preservation. Fresh-snapshot install.py completion and file-lock/deferred-deletion handling remain outside this PR.

Fixture E2E uses ComfyUI 039ed38e on Python 3.10.20 and frontend 1.45.15; other tests use Python 3.12. v3 starts without --enable-manager. Browser checks use single-tab sessions. The public Registry was not exercised in this rerun.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/ComfyUI-Manager/pull/3298 **Author:** [@ltdrdata](https://github.com/ltdrdata) **Created:** 9/18/2026 **Status:** ✅ Merged **Merged:** 9/18/2026 **Merged by:** [@ltdrdata](https://github.com/ltdrdata) **Base:** `main` ← **Head:** `feat/v3-flagged-policy` --- ### 📝 Commits (1) - [`1796c72`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/1796c72fcdcbc39aac440516b30277aad9e2f4af) Restrict flagged CNR installs on non-local listeners ### 📊 Changes **10 files changed** (+1004 additions, -91 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+45 -0) 📝 `glob/cnr_utils.py` (+2 -1) 📝 `glob/manager_core.py` (+138 -68) 📝 `glob/manager_server.py` (+19 -10) 📝 `glob/manager_util.py` (+47 -1) 📝 `prestartup_script.py` (+21 -3) ➕ `tests/e2e/test_e2e_flagged_nodepacks.py` (+400 -0) ➕ `tests/test_flagged_nodepack_policy.py` (+325 -0) 📝 `tests/test_install_flags_gates.py` (+3 -3) 📝 `tests/test_write_config_persistence.py` (+4 -5) </details> ### 📄 Description ## Purpose and scope A successful Registry install response previously allowed a Flagged CNR version to proceed. Require Flagged versions to satisfy the same installation conditions as Active versions, plus a server listening exclusively on loopback or an explicit administrator override. Covers installation, reinstallation, switching, updates, deferred startup and server-scheduled restores. The allow_flagged_nodepack_install option belongs in config.ini’s [default] section. It defaults to false; only case-insensitive true enables it, after restarting ComfyUI. The override is intended for a trusted private network and permits non-loopback listeners. It does not detect private networks or bypass common security checks, Registry refusals or Git/pip restrictions. Active and Pending installation behavior is retained. ## Key changes - Use status from the existing CNR install response. Check policy before changing the current pack and reuse that response for execution, without another Registry lookup. - Validate reinstallation before removal, then install and rerun the pack’s script. Preserve files and activation state on denial, retain the reason in queue/update results and avoid retrying rejected restore targets. - Recheck deferred work against current startup settings and pass the resolved server permission to scheduled restore children. Standalone CLI retains its existing interface and local administrator behavior. - Show a short security-configuration denial in the UI. Only terminal logs provide the loopback listener and private-network override remedies, including restart instructions. Affected modules: CNR metadata mapping, installation core, server queues, startup processing, configuration and README. Deferred switches use stored status without refreshing it from the Registry. Older reservations without status require loopback-only listeners or the override; otherwise startup rejects them without changing the pack and tells the user to request installation again. Enabling an already installed identical version remains a local activation with no Registry lookup or installation script. ## Validation approach Core tests run production installation paths with controlled external responses. Server E2E uses real HTTP requests, queues, ZIP installation, restart and CLI subprocesses, with a local Registry and isolated paths, settings and databases. Live Chromium scenarios also exercise the combined UI through real routes and WebSocket completion. | Intent | Observed result | |---|---| | Add restrictions only to Flagged | Active/Pending controls install; Flagged needs loopback or override. Strong-security controls reject both Active and Flagged before metadata lookup. | | Preserve state on denial | Existing files, versions and activation state survive; no download or reservation is created. | | Avoid duplicate lookups | Count metadata requests through installation and restore; deferred switches make no additional lookup. | | Preserve execution context | Check immediate/deferred execution, old reservations, callback timing, standalone CLI behavior and actual server-scheduled restore children. Existing-version activation requires no Registry lookup or installation script. | | Keep errors and settings correct | Verify short UI errors versus terminal remedies, Registry refusal, listener edge cases and preservation of an administrator's option during an unrelated UI save. | Tests fail when status propagation or reinstall script execution is deliberately removed, and pass when restored. Allowed installation controls also pass. ## Validation results | Scope | Result | |---|---| | Standalone 1796c72f, non-E2E regression | 89 passed; 22 subtests passed | | UI + Flagged integration cc3d1001, non-E2E regression | 235 passed; 221 subtests passed | | Policy server E2E on the final production files | 60 passed; 6 skipped | | Live browser E2E on the final production files | 7 scenarios passed; no uncaught browser exceptions | The six policy E2E skips require a preinstalled pack under strong security. Strong-security denial is tested directly. The full policy suite passed when run alone after an initial parallel run encountered a test-server port collision. No product code or assertions were changed to address that fixture collision. Snapshot checks establish admission, extraction and denial-state preservation. Fresh-snapshot install.py completion and file-lock/deferred-deletion handling remain outside this PR. Fixture E2E uses ComfyUI 039ed38e on Python 3.10.20 and frontend 1.45.15; other tests use Python 3.12. v3 starts without --enable-manager. Browser checks use single-tab sessions. The public Registry was not exercised in this rerun. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-28 21:15:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#3173
No description provided.