ComfyUI-Manager/comfyui_manager/common
Jedrzej Kosinski 622a7077a5
Some checks are pending
Python Linting / Run Ruff (push) Waiting to run
fix(git_compat): harden pygit2 fallback path; prefer system git when available (#2972)
* fix(git_compat): ignore global git config in pygit2 backend

Under Desktop 2.0 the launcher sets CM_USE_PYGIT2=1, so the pygit2 backend ran clone_repository/remote.fetch with no credentials callback and honored the user's global git config. An insteadOf rewrite (https->ssh) or credential helper then forced authentication, failing with 'authentication required but no callback set'.

Blank the system/global/XDG config search path at import time so libgit2 operations are hermetic, and normalize SSH-form GitHub URLs to anonymous HTTPS on clone and when opening a repo.

Amp-Thread-ID: https://ampcode.com/threads/T-019eafa0-16a1-726e-91a4-dac1a40d4481
Co-authored-by: Amp <amp@ampcode.com>

* fix(git_compat): preserve corporate http.proxy in pygit2 backend

Snapshot http.proxy from the global git config before blanking the config search path, then pass it explicitly (proxy=) to clone_repository and every remote.fetch() in the pygit2 backend, so corporate-lockdown proxy setups keep working after the insteadOf/SSH hardening.

Amp-Thread-ID: https://ampcode.com/threads/T-019eafa0-16a1-726e-91a4-dac1a40d4481
Co-authored-by: Amp <amp@ampcode.com>

* fix(git_compat): stop rewriting repo remotes on disk under pygit2 backend

Removing _normalize_remote_urls(): persistently rewriting a repo's SSH origin
to HTTPS mutates on-disk repo state, which is risky if interrupted. The pygit2
backend already neutralizes auth-forcing global config (insteadOf, credential
helpers) by blanking libgit2's config search path, so anonymous HTTPS fetch
works without touching the stored remote.

Manager already prefers the GitPython/system-git backend when a system git is
present (which honors the user's full git config including insteadOf https->ssh
and proxies), and only uses the bundled pygit2 when system git is absent or
CM_USE_PYGIT2=1 is set.

Amp-Thread-ID: https://ampcode.com/threads/T-019eafa0-16a1-726e-91a4-dac1a40d4481
Co-authored-by: Amp <amp@ampcode.com>

* fix(git_compat): fetch SSH-origin repos via in-memory anonymous HTTPS

Consolidate the five pygit2 fetch sites into a single _fetch_remote helper.
When a repo's stored origin is SSH-form (git@host:owner/repo), the bundled
pygit2 (no SSH transport) would fail with an auth error; fetch through an
in-memory anonymous remote over HTTPS instead, leaving .git/config untouched.
Also closes a proxy hole where get_remote() exposed remote.fetch without the
preserved http.proxy.

Validated against both backends (pygit2 1.19.2 + GitPython): all 47
git_compat tests pass; verified create_anonymous fetch updates
refs/remotes/origin/* without persisting any remote or rewriting origin.

Amp-Thread-ID: https://ampcode.com/threads/T-019eafa0-16a1-726e-91a4-dac1a40d4481
Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-06-10 16:33:18 +09:00
..
__init__.py fix(git): handle divergent branches safely + datetime fallback 2025-12-12 22:45:05 +09:00
cm_global.py restructuring 2025-04-13 09:26:02 +09:00
cnr_utils.py refactor(core): add verbose config, improve module lookup, fix is_valid_url 2025-12-27 03:57:19 +09:00
context.py feat: add pygit2 compatibility wrapper for standalone Desktop 2.0 installs (#2719) 2026-03-27 08:42:26 +09:00
enums.py modified: security policy 2025-06-27 01:38:38 +09:00
git_compat.py fix(git_compat): harden pygit2 fallback path; prefer system git when available (#2972) 2026-06-10 16:33:18 +09:00
git_helper.py feat: add pygit2 compatibility wrapper for standalone Desktop 2.0 installs (#2719) 2026-03-27 08:42:26 +09:00
git_utils.py fix(api): improve import_fail_info_bulk lookup for cnr_id and aux_id 2025-12-15 02:54:30 +09:00
manager_downloader.py Merge branch 'main' into draft-v4 2025-07-24 12:41:48 +09:00
manager_security.py fix(security): harden CSRF with Content-Type gate and expand E2E coverage (#2818) 2026-04-22 05:04:30 +09:00
manager_util.py feat(deps): add unified dependency resolver using uv pip compile (#2589) 2026-03-07 06:51:53 +09:00
node_package.py restructuring 2025-04-13 09:26:02 +09:00
README.md Merge branch 'main' into draft-v4 2025-06-01 06:23:11 +09:00
security_check.py fix(security): add litellm supply chain attack detection (PYSEC-2026-2) (#2732) 2026-03-26 04:17:50 +09:00
timestamp_utils.py feat: add pygit2 compatibility wrapper for standalone Desktop 2.0 installs (#2719) 2026-03-27 08:42:26 +09:00
unified_dep_resolver.py feat(cli): expand --uv-compile to all node management commands with conflict attribution (#2682) 2026-03-14 07:58:29 +09:00

ComfyUI-Manager: Core Backend (glob)

This directory contains the Python backend modules that power ComfyUI-Manager, handling the core functionality of node management, downloading, security, and server operations.

Core Modules

  • manager_downloader.py: Handles downloading operations for models, extensions, and other resources.
  • manager_util.py: Provides utility functions used throughout the system.

Specialized Modules

  • cm_global.py: Maintains global variables and state management across the system.
  • cnr_utils.py: Helper utilities for interacting with the custom node registry (CNR).
  • git_utils.py: Git-specific utilities for repository operations.
  • node_package.py: Handles the packaging and installation of node extensions.
  • security_check.py: Implements the multi-level security system for installation safety.