comfyui-manager 4.2.2__tar.gz → 4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. {comfyui_manager-4.2.2/comfyui_manager.egg-info → comfyui_manager-4.3}/PKG-INFO +55 -3
  2. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/README.md +52 -2
  3. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/cnr_utils.py +2 -1
  4. comfyui_manager-4.3/comfyui_manager/common/config_writer.py +76 -0
  5. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/manager_security.py +42 -0
  6. comfyui_manager-4.3/comfyui_manager/common/security_messages.py +7 -0
  7. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/unified_dep_resolver.py +8 -3
  8. comfyui_manager-4.3/comfyui_manager/glob/constants.py +47 -0
  9. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/manager_core.py +98 -71
  10. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/manager_server.py +14 -9
  11. comfyui_manager-4.3/comfyui_manager/glob/utils/formatting_utils.py +21 -0
  12. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/comfyui-manager.js +10 -9
  13. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/comfyui-share-common.js +3 -2
  14. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/comfyui-share-copus.js +2 -2
  15. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/comfyui-share-openart.js +2 -2
  16. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/comfyui-share-youml.js +2 -2
  17. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/common.js +53 -3
  18. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/custom-nodes-manager.js +93 -58
  19. comfyui_manager-4.3/comfyui_manager/js/manager-grid.js +67 -0
  20. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/model-manager.js +90 -92
  21. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/snapshot.js +3 -3
  22. comfyui_manager-4.3/comfyui_manager/legacy/html_utils.py +82 -0
  23. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/legacy/manager_core.py +175 -118
  24. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/legacy/manager_server.py +81 -65
  25. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/prestartup_script.py +23 -3
  26. {comfyui_manager-4.2.2 → comfyui_manager-4.3/comfyui_manager.egg-info}/PKG-INFO +55 -3
  27. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager.egg-info/SOURCES.txt +9 -0
  28. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager.egg-info/requires.txt +2 -0
  29. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/pyproject.toml +4 -2
  30. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/requirements.txt +2 -0
  31. comfyui_manager-4.3/tests/test_config_write_and_install_denial.py +800 -0
  32. comfyui_manager-4.3/tests/test_flagged_nodepack_policy.py +431 -0
  33. comfyui_manager-4.3/tests/test_grid_highlight_escaping.py +189 -0
  34. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/tests/test_install_flags_config.py +3 -2
  35. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/tests/test_legacy_secgate_other_paths.py +3 -3
  36. comfyui_manager-4.3/tests/test_markdown_composer_href.py +114 -0
  37. comfyui_manager-4.3/tests/test_notice_html_sanitizer.py +134 -0
  38. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/tests/test_unified_dep_resolver.py +53 -2
  39. comfyui_manager-4.2.2/comfyui_manager/glob/constants.py +0 -56
  40. comfyui_manager-4.2.2/comfyui_manager/glob/utils/formatting_utils.py +0 -60
  41. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/LICENSE.txt +0 -0
  42. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/MANIFEST.in +0 -0
  43. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/cm_cli/__init__.py +0 -0
  44. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/cm_cli/__main__.py +0 -0
  45. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/__init__.py +0 -0
  46. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/alter-list.json +0 -0
  47. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/channels.list.template +0 -0
  48. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/__init__.py +0 -0
  49. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/cm_global.py +0 -0
  50. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/context.py +0 -0
  51. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/enums.py +0 -0
  52. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/git_compat.py +0 -0
  53. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/git_helper.py +0 -0
  54. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/git_utils.py +0 -0
  55. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/manager_downloader.py +0 -0
  56. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/manager_util.py +0 -0
  57. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/node_package.py +0 -0
  58. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/security_check.py +0 -0
  59. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/common/timestamp_utils.py +0 -0
  60. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/custom-node-list.json +0 -0
  61. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/data_models/__init__.py +0 -0
  62. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/data_models/generated_models.py +0 -0
  63. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/extension-node-map.json +0 -0
  64. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/extras.json +0 -0
  65. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/github-stats.json +0 -0
  66. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/CLAUDE.md +0 -0
  67. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/__init__.py +0 -0
  68. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/share_3rdparty.py +0 -0
  69. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/utils/__init__.py +0 -0
  70. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/utils/environment_utils.py +0 -0
  71. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/utils/model_utils.py +0 -0
  72. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/utils/node_pack_utils.py +0 -0
  73. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/glob/utils/security_utils.py +0 -0
  74. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/README.md +0 -0
  75. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/cm-api.js +0 -0
  76. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/comfyui-gui-builder.js +0 -0
  77. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/custom-nodes-manager.css +0 -0
  78. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/model-manager.css +0 -0
  79. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/node_fixer.js +0 -0
  80. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/popover-helper.js +0 -0
  81. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/snapshot.css +0 -0
  82. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/turbogrid.esm.js +0 -0
  83. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/js/workflow-metadata.js +0 -0
  84. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/legacy/__init__.py +0 -0
  85. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/legacy/share_3rdparty.py +0 -0
  86. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager/model-list.json +0 -0
  87. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager.egg-info/dependency_links.txt +0 -0
  88. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager.egg-info/entry_points.txt +0 -0
  89. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/comfyui_manager.egg-info/top_level.txt +0 -0
  90. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/setup.cfg +0 -0
  91. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/tests/test_git_compat.py +0 -0
  92. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/tests/test_install_flags_guards.py +0 -0
  93. {comfyui_manager-4.2.2 → comfyui_manager-4.3}/tests/test_nightly_cnr_fallback.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: comfyui-manager
3
- Version: 4.2.2
3
+ Version: 4.3
4
4
  Summary: ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI.
5
5
  Maintainer-email: "Dr.Lt.Data" <dr.lt.data@gmail.com>, Yoland Yan <yoland@comfy.org>, James Kwon <hongilkwon316@gmail.com>, Robin Huang <robin@comfy.org>
6
6
  License: GPL-3.0-only
@@ -22,6 +22,8 @@ Requires-Dist: typing-extensions
22
22
  Requires-Dist: toml
23
23
  Requires-Dist: uv
24
24
  Requires-Dist: chardet
25
+ Requires-Dist: packaging
26
+ Requires-Dist: nh3>=0.3.7
25
27
  Provides-Extra: dev
26
28
  Requires-Dist: pre-commit; extra == "dev"
27
29
  Requires-Dist: pytest; extra == "dev"
@@ -248,6 +250,7 @@ The following settings are applied based on the section marked as `is_default`.
248
250
  security_level = <Set the security level => strong|normal|normal-|weak>
249
251
  allow_git_url_install = <Allow installing custom nodes from arbitrary git URLs. Independent of security_level. Default: False>
250
252
  allow_pip_install = <Allow installing arbitrary pip packages via the Manager. Independent of security_level. Default: False>
253
+ allow_flagged_nodepack_install = <Allow flagged CNR versions on non-local listeners in trusted private networks. Default: False>
251
254
  always_lazy_install = <Whether to perform dependency installation on restart even in environments other than Windows.>
252
255
  network_mode = <Set the network mode => public|private|offline|personal_cloud>
253
256
  ```
@@ -360,8 +363,8 @@ The security settings are applied based on whether the ComfyUI server's listener
360
363
  |-------------|---------------------------------------------------------------------------------------------------------------------------------------|
361
364
  | high+ | * **Switch ComfyUI version**<BR>* **Fix nodepack** |
362
365
  | high | _(no features at this tier — `Fix nodepack` promoted to `high+` to align the enforcement gate with the `SECURITY_MESSAGE_HIGH_P` log text)_ |
363
- | middle+ | * Uninstall/Update<BR>* Installation of nodepack registered in the `default channel`.<BR>* Restore/Remove Snapshot<BR>* Install model |
364
- | middle | * Restart |
366
+ | middle+ | * Uninstall/Update<BR>* Installation of Git/nightly nodepacks registered in the `default channel`.<BR>* Restore/Remove Snapshot<BR>* Install model |
367
+ | middle | * Restart<BR>* Installation of CNR release versions (subject to the flagged-version policy below) |
365
368
  | low | * Update ComfyUI |
366
369
 
367
370
  * **Note**: `Install via git url` and `pip install` are no longer gated by `security_level` — they moved to the dedicated flags `allow_git_url_install` / `allow_pip_install`. Installation of a nodepack registered not in the `default channel` likewise requires `allow_git_url_install` (in addition to the `middle+` level preconditions) instead of a `high+` security level. See the [Dedicated install flags](#dedicated-install-flags-allow_git_url_install--allow_pip_install) subsection below.
@@ -391,6 +394,55 @@ The `Install via git url` and `pip install` features are governed by two dedicat
391
394
  * Changes to these flags require a restart of ComfyUI to take effect.
392
395
  * Migration note: if you previously relied on `security_level = weak` or `normal-` to use these features, you must now opt in explicitly by setting the flags in the `[default]` section of `config.ini`. The flags are not auto-seeded from your `security_level`.
393
396
 
397
+ ### Flagged CNR nodepacks
398
+
399
+ Before downloading a CNR release, Manager checks the selected version's `status`
400
+ in the existing `/nodes/{id}/install` response. No additional Registry request is
401
+ needed. The check applies to both the default and legacy Manager implementations,
402
+ including CNR version changes, updates, and snapshot restores. Legacy batch
403
+ reinstallation checks the target before removing the existing nodepack, and a
404
+ policy refusal preserves the current installation. For flagged-policy denials,
405
+ the UI reports that the current security configuration does not allow the action
406
+ and directs users to the terminal. Only the terminal provides loopback-only
407
+ `--listen` examples, the private network override setting, and restart instructions.
408
+
409
+ * Active versions continue through the normal install flow. CNR release installs
410
+ use the `middle` security level, so they are available on non-local listeners
411
+ with `security_level = normal`, `normal-`, or `weak`. `strong` still denies
412
+ these install requests.
413
+ * Flagged versions (`NodeVersionStatusFlagged`) must satisfy the same installation
414
+ conditions as Active versions. In addition, **all** addresses in `--listen`
415
+ must resolve to loopback, such as `127.0.0.1` and `::1`, unless the explicit
416
+ override below is enabled.
417
+ * To allow flagged versions on a non-local listener in a **trusted private
418
+ network**, an administrator can explicitly opt in:
419
+
420
+ ```ini
421
+ [default]
422
+ allow_flagged_nodepack_install = true
423
+ ```
424
+
425
+ * The option defaults to `false`. Only `true` (case-insensitive) enables it;
426
+ missing or invalid values are treated as `false`. Restart ComfyUI after editing it.
427
+ * With this option enabled, the flagged-version check allows installation
428
+ regardless of the listen address. Manager does not automatically detect a
429
+ private network. This option does not require `network_mode = private`, and
430
+ `network_mode = personal_cloud` alone does not allow flagged versions.
431
+ * CNR API refusals, including banned or unavailable packages, still prevent
432
+ installation. This option does not override `security_level = strong` or
433
+ the separate Git/nightly and pip installation policies.
434
+ * Enabling an already installed version does not query the Registry or reinstall it.
435
+ * Older deferred switches without a stored status require loopback-only listeners
436
+ or the override. Otherwise they are rejected without changing the installed pack;
437
+ request the installation again so Manager can check its current Registry status.
438
+ * Newly scheduled deferred version switches retain the returned version status
439
+ and check it against the current listen address and option again at restart.
440
+ This uses the saved status; it does not query CNR again for later status changes.
441
+ Server-scheduled snapshot restores inherit the permission computed from the
442
+ server's current listener and setting.
443
+ * Standalone `cm-cli` commands remain local administrator operations and do not
444
+ use the server listener policy.
445
+
394
446
 
395
447
  # Disclaimer
396
448
 
@@ -216,6 +216,7 @@ The following settings are applied based on the section marked as `is_default`.
216
216
  security_level = <Set the security level => strong|normal|normal-|weak>
217
217
  allow_git_url_install = <Allow installing custom nodes from arbitrary git URLs. Independent of security_level. Default: False>
218
218
  allow_pip_install = <Allow installing arbitrary pip packages via the Manager. Independent of security_level. Default: False>
219
+ allow_flagged_nodepack_install = <Allow flagged CNR versions on non-local listeners in trusted private networks. Default: False>
219
220
  always_lazy_install = <Whether to perform dependency installation on restart even in environments other than Windows.>
220
221
  network_mode = <Set the network mode => public|private|offline|personal_cloud>
221
222
  ```
@@ -328,8 +329,8 @@ The security settings are applied based on whether the ComfyUI server's listener
328
329
  |-------------|---------------------------------------------------------------------------------------------------------------------------------------|
329
330
  | high+ | * **Switch ComfyUI version**<BR>* **Fix nodepack** |
330
331
  | high | _(no features at this tier — `Fix nodepack` promoted to `high+` to align the enforcement gate with the `SECURITY_MESSAGE_HIGH_P` log text)_ |
331
- | middle+ | * Uninstall/Update<BR>* Installation of nodepack registered in the `default channel`.<BR>* Restore/Remove Snapshot<BR>* Install model |
332
- | middle | * Restart |
332
+ | middle+ | * Uninstall/Update<BR>* Installation of Git/nightly nodepacks registered in the `default channel`.<BR>* Restore/Remove Snapshot<BR>* Install model |
333
+ | middle | * Restart<BR>* Installation of CNR release versions (subject to the flagged-version policy below) |
333
334
  | low | * Update ComfyUI |
334
335
 
335
336
  * **Note**: `Install via git url` and `pip install` are no longer gated by `security_level` — they moved to the dedicated flags `allow_git_url_install` / `allow_pip_install`. Installation of a nodepack registered not in the `default channel` likewise requires `allow_git_url_install` (in addition to the `middle+` level preconditions) instead of a `high+` security level. See the [Dedicated install flags](#dedicated-install-flags-allow_git_url_install--allow_pip_install) subsection below.
@@ -359,6 +360,55 @@ The `Install via git url` and `pip install` features are governed by two dedicat
359
360
  * Changes to these flags require a restart of ComfyUI to take effect.
360
361
  * Migration note: if you previously relied on `security_level = weak` or `normal-` to use these features, you must now opt in explicitly by setting the flags in the `[default]` section of `config.ini`. The flags are not auto-seeded from your `security_level`.
361
362
 
363
+ ### Flagged CNR nodepacks
364
+
365
+ Before downloading a CNR release, Manager checks the selected version's `status`
366
+ in the existing `/nodes/{id}/install` response. No additional Registry request is
367
+ needed. The check applies to both the default and legacy Manager implementations,
368
+ including CNR version changes, updates, and snapshot restores. Legacy batch
369
+ reinstallation checks the target before removing the existing nodepack, and a
370
+ policy refusal preserves the current installation. For flagged-policy denials,
371
+ the UI reports that the current security configuration does not allow the action
372
+ and directs users to the terminal. Only the terminal provides loopback-only
373
+ `--listen` examples, the private network override setting, and restart instructions.
374
+
375
+ * Active versions continue through the normal install flow. CNR release installs
376
+ use the `middle` security level, so they are available on non-local listeners
377
+ with `security_level = normal`, `normal-`, or `weak`. `strong` still denies
378
+ these install requests.
379
+ * Flagged versions (`NodeVersionStatusFlagged`) must satisfy the same installation
380
+ conditions as Active versions. In addition, **all** addresses in `--listen`
381
+ must resolve to loopback, such as `127.0.0.1` and `::1`, unless the explicit
382
+ override below is enabled.
383
+ * To allow flagged versions on a non-local listener in a **trusted private
384
+ network**, an administrator can explicitly opt in:
385
+
386
+ ```ini
387
+ [default]
388
+ allow_flagged_nodepack_install = true
389
+ ```
390
+
391
+ * The option defaults to `false`. Only `true` (case-insensitive) enables it;
392
+ missing or invalid values are treated as `false`. Restart ComfyUI after editing it.
393
+ * With this option enabled, the flagged-version check allows installation
394
+ regardless of the listen address. Manager does not automatically detect a
395
+ private network. This option does not require `network_mode = private`, and
396
+ `network_mode = personal_cloud` alone does not allow flagged versions.
397
+ * CNR API refusals, including banned or unavailable packages, still prevent
398
+ installation. This option does not override `security_level = strong` or
399
+ the separate Git/nightly and pip installation policies.
400
+ * Enabling an already installed version does not query the Registry or reinstall it.
401
+ * Older deferred switches without a stored status require loopback-only listeners
402
+ or the override. Otherwise they are rejected without changing the installed pack;
403
+ request the installation again so Manager can check its current Registry status.
404
+ * Newly scheduled deferred version switches retain the returned version status
405
+ and check it against the current listen address and option again at restart.
406
+ This uses the saved status; it does not query CNR again for later status changes.
407
+ Server-scheduled snapshot restores inherit the permission computed from the
408
+ server's current listener and setting.
409
+ * Standalone `cm-cli` commands remain local administrator operations and do not
410
+ use the server listener policy.
411
+
362
412
 
363
413
  # Disclaimer
364
414
 
@@ -134,6 +134,7 @@ class NodeVersion:
134
134
  id: str
135
135
  version: str
136
136
  download_url: str
137
+ status: str = ''
137
138
 
138
139
 
139
140
  def map_node_version(api_node_version):
@@ -165,6 +166,7 @@ def map_node_version(api_node_version):
165
166
  download_url=api_node_version.get(
166
167
  "downloadUrl", ""
167
168
  ), # Provide a default value if 'downloadUrl' is missing
169
+ status=api_node_version.get('status', ''),
168
170
  )
169
171
 
170
172
 
@@ -257,4 +259,3 @@ def read_cnr_id(fullpath):
257
259
  pass
258
260
 
259
261
  return None
260
-
@@ -0,0 +1,76 @@
1
+ """Shared settings-file writer for glob and legacy."""
2
+ import configparser
3
+ import os
4
+ import tempfile
5
+
6
+ from rich import print
7
+
8
+
9
+ class DirtyTrackingConfig(dict):
10
+ """Track keys assigned after loading the startup configuration."""
11
+
12
+ def __init__(self, *args, **kwargs):
13
+ super().__init__(*args, **kwargs)
14
+ self.dirty_keys = set()
15
+
16
+ def __setitem__(self, key, value):
17
+ self.dirty_keys.add(key)
18
+ super().__setitem__(key, value)
19
+
20
+ def update(self, *args, **kwargs):
21
+ incoming = dict(*args, **kwargs)
22
+ self.dirty_keys.update(incoming)
23
+ super().update(incoming)
24
+
25
+
26
+ def write_config_merged(config_path, cached, written_config_keys):
27
+ """Merge changed owned keys onto the latest settings on disk.
28
+
29
+ Preserve parsed keys and values, not INI comments or formatting."""
30
+ config = configparser.ConfigParser(strict=False)
31
+ try:
32
+ loaded = config.read(config_path)
33
+ except (configparser.Error, UnicodeDecodeError) as e:
34
+ # Preserve the existing fallback for malformed files.
35
+ print(f"[ComfyUI-Manager] Warning: '{config_path}' could not be parsed ({e}); rewriting it from the current settings.")
36
+ config = configparser.ConfigParser(strict=False)
37
+ else:
38
+ # ConfigParser.read silently skips unreadable files; do not overwrite one.
39
+ if not loaded and os.path.exists(config_path):
40
+ raise OSError(f"'{config_path}' exists but could not be read; refusing to overwrite it with default settings. Fix the file's permissions, then retry.")
41
+
42
+ if config.has_section('default'):
43
+ keys = [key for key in written_config_keys if key in cached.dirty_keys]
44
+ else:
45
+ config['default'] = {}
46
+ keys = list(written_config_keys)
47
+
48
+ section = config['default']
49
+ for key in keys:
50
+ section[key] = str(cached[key]).replace('\r', '').replace('\n', '').replace('\x00', '')
51
+
52
+ directory = os.path.dirname(config_path)
53
+ if directory and not os.path.exists(directory):
54
+ os.makedirs(directory)
55
+
56
+ # Replace from the same directory so readers never see a partial write.
57
+ tmp_path = None
58
+ try:
59
+ with tempfile.NamedTemporaryFile(
60
+ 'w', dir=directory or '.', prefix='.config-', suffix='.tmp', delete=False
61
+ ) as configfile:
62
+ tmp_path = configfile.name
63
+ config.write(configfile)
64
+ configfile.flush()
65
+ os.fsync(configfile.fileno())
66
+ # Retain the existing mode instead of the temporary file's 0600.
67
+ if os.path.exists(config_path):
68
+ os.chmod(tmp_path, os.stat(config_path).st_mode & 0o777)
69
+ os.replace(tmp_path, config_path)
70
+ tmp_path = None
71
+ finally:
72
+ if tmp_path is not None and os.path.exists(tmp_path):
73
+ os.remove(tmp_path)
74
+
75
+ # Clear only persisted keys, and only after a successful write.
76
+ cached.dirty_keys.difference_update(keys)
@@ -27,6 +27,22 @@ from aiohttp import web
27
27
  is_personal_cloud_mode = False
28
28
  handler_policy = {}
29
29
 
30
+ FLAGGED_NODEPACK_INSTALL_ERROR = (
31
+ 'This action is not allowed by the current security configuration. '
32
+ 'See the terminal for details.'
33
+ )
34
+ FLAGGED_NODEPACK_INSTALL_GUIDANCE = (
35
+ 'Installation of this flagged CNR version is blocked. To satisfy the additional '
36
+ 'flagged-version requirement, choose one of the following:\n'
37
+ '1. Run ComfyUI with loopback-only listeners, for example --listen 127.0.0.1 '
38
+ 'or --listen ::1. All configured listen addresses must be loopback.\n'
39
+ ' Do not use bare --listen or any non-loopback address, such as 0.0.0.0 or ::.\n'
40
+ '2. For a trusted private network, set allow_flagged_nodepack_install = true '
41
+ 'in the [default] section of ComfyUI-Manager\'s config.ini.\n'
42
+ 'Restart ComfyUI after changing the listener or configuration. '
43
+ 'All other installation security checks still apply.'
44
+ )
45
+
30
46
 
31
47
  # CORS "simple request" Content-Type set per Fetch spec §3.2.3. Browsers send
32
48
  # <form method=POST> submissions with one of these three MIME types and do NOT
@@ -83,6 +99,32 @@ def is_loopback(address):
83
99
  return False
84
100
 
85
101
 
102
+ def is_loopback_listener(listen_address: str) -> bool:
103
+ """All addresses bound by --listen must resolve exclusively to loopback."""
104
+ import socket
105
+
106
+ if not isinstance(listen_address, str) or not listen_address:
107
+ return False
108
+ for address in listen_address.split(','):
109
+ address = address.strip()
110
+ if not address:
111
+ return False
112
+ if is_loopback(address):
113
+ continue
114
+ try:
115
+ resolved = socket.getaddrinfo(address, None, type=socket.SOCK_STREAM)
116
+ except OSError:
117
+ return False
118
+ if not resolved or any(not is_loopback(item[4][0]) for item in resolved):
119
+ return False
120
+ return True
121
+
122
+
123
+ def is_cnr_install_allowed(status: str, allow_flagged: bool, listen_address: str) -> bool:
124
+ """Only flagged versions require loopback or the private-network opt-in."""
125
+ return status != 'NodeVersionStatusFlagged' or bool(allow_flagged) or is_loopback_listener(listen_address)
126
+
127
+
86
128
  def is_dedicated_install_allowed(flag_value: bool, listen_address: str, network_mode: str) -> bool:
87
129
  """P-direct predicate for the dedicated install flags (goal265-spec.md §1.2).
88
130
 
@@ -0,0 +1,7 @@
1
+ """Installation-denial messages shared by the glob and legacy servers."""
2
+
3
+ SECURITY_MESSAGE_MIDDLE = "ERROR: To use this action, a security_level of `normal or below` is required. Please contact the administrator.\nReference: https://github.com/Comfy-Org/ComfyUI-Manager#security-policy"
4
+ SECURITY_MESSAGE_MIDDLE_P = "ERROR: To use this action, security_level must be `normal or below`, and network_mode must be set to `personal_cloud`. Please contact the administrator.\nReference: https://github.com/Comfy-Org/ComfyUI-Manager#security-policy"
5
+ SECURITY_MESSAGE_HIGH_P = "ERROR: To use this action, '--listen' must be set to a local IP and security_level must be 'normal-' or lower. Please contact the administrator.\nReference: https://github.com/Comfy-Org/ComfyUI-Manager#security-policy"
6
+ SECURITY_MESSAGE_GENERAL = "ERROR: This installation is not allowed in this security_level. Please contact the administrator.\nReference: https://github.com/Comfy-Org/ComfyUI-Manager#security-policy"
7
+ SECURITY_MESSAGE_NORMAL_MINUS_MODEL = "ERROR: Downloading models that are not in '.safetensors' format is only allowed for models registered in the 'default' channel at this security level. If you want to download this model, set the security level to 'normal-' or lower."
@@ -656,10 +656,15 @@ class UnifiedDepResolver:
656
656
  def _parse_conflicts(stderr: str) -> list[str]:
657
657
  """Extract conflict descriptions from ``uv pip compile`` stderr."""
658
658
  conflicts: list[str] = []
659
- for line in stderr.splitlines():
660
- line = line.strip()
661
- if line and ('conflict' in line.lower() or 'error' in line.lower()):
659
+ in_diagnostic = False
660
+ for raw_line in stderr.splitlines():
661
+ line = raw_line.strip()
662
+ if line and ('conflict' in line.lower() or 'error' in line.lower()
663
+ or (in_diagnostic and raw_line[0].isspace())):
662
664
  conflicts.append(line)
665
+ in_diagnostic = True
666
+ else:
667
+ in_diagnostic = False
663
668
  return conflicts or [stderr.strip()] if stderr.strip() else []
664
669
 
665
670
  @staticmethod
@@ -0,0 +1,47 @@
1
+ def is_loopback(address):
2
+ import ipaddress
3
+
4
+ try:
5
+ return ipaddress.ip_address(address).is_loopback
6
+ except ValueError:
7
+ return False
8
+
9
+
10
+ model_dir_name_map = {
11
+ "checkpoints": "checkpoints",
12
+ "checkpoint": "checkpoints",
13
+ "unclip": "checkpoints",
14
+ "text_encoders": "text_encoders",
15
+ "clip": "text_encoders",
16
+ "vae": "vae",
17
+ "lora": "loras",
18
+ "t2i-adapter": "controlnet",
19
+ "t2i-style": "controlnet",
20
+ "controlnet": "controlnet",
21
+ "clip_vision": "clip_vision",
22
+ "gligen": "gligen",
23
+ "upscale": "upscale_models",
24
+ "embedding": "embeddings",
25
+ "embeddings": "embeddings",
26
+ "unet": "diffusion_models",
27
+ "diffusion_model": "diffusion_models",
28
+ }
29
+
30
+ # List of all model directory names used for checking installed models
31
+ MODEL_DIR_NAMES = [
32
+ "checkpoints",
33
+ "loras",
34
+ "vae",
35
+ "text_encoders",
36
+ "diffusion_models",
37
+ "clip_vision",
38
+ "embeddings",
39
+ "diffusers",
40
+ "vae_approx",
41
+ "controlnet",
42
+ "gligen",
43
+ "upscale_models",
44
+ "hypernetworks",
45
+ "photomaker",
46
+ "classifiers",
47
+ ]