Skip to content

chore(release): 4.2.1 — register extension.manager.supports_csrf_post feature flag#2823

Merged
ltdrdata merged 1 commit intomanager-v4from
fix/csrf-post-feature-flag
Apr 22, 2026
Merged

chore(release): 4.2.1 — register extension.manager.supports_csrf_post feature flag#2823
ltdrdata merged 1 commit intomanager-v4from
fix/csrf-post-feature-flag

Conversation

@ltdrdata
Copy link
Copy Markdown
Member

Summary

Follow-up to #2818. Registers a server-push feature flag so clients can detect CSRF-POST backend capability via ComfyUI core's feature_flags mechanism instead of parsing version strings.

  • Flag: extension.manager.supports_csrf_post = True, registered at Manager import time in comfyui_manager/__init__.py via comfy_api.feature_flags.SERVER_FEATURE_FLAGS.
  • Manager versions prior to 4.2.1 do not set the flag. Clients (ComfyUI_frontend, third-party extensions) observe its absence and should treat the backend as incompatible with POST-only state-mutation endpoints, prompting the user to upgrade.
  • ImportError on older ComfyUI cores without comfy_api.feature_flags is swallowed silently — Manager continues to function, clients simply do not observe the flag.
  • No endpoint or security behavior change. Pure capability advertisement.

Version bump

  • pyproject.toml: 4.2.0 → 4.2.1 (SSOT; importlib.metadata.version("comfyui-manager") reads from here)
  • CHANGELOG.md: new ## [4.2.1] - 2026-04-22 entry

Test plan

  • Verify flag is registered at import time: python -c "from comfy_api import feature_flags; import comfyui_manager; print(feature_flags.SERVER_FEATURE_FLAGS['extension']['manager']['supports_csrf_post'])" -> True
  • Verify graceful fallback on older ComfyUI core without comfy_api.feature_flags (Manager still imports, no exception propagated).
  • Verify frontend can observe the flag via existing feature_flags WebSocket/HTTP channel.
  • Confirm no behavior change on any state-mutation POST handler.

@ltdrdata ltdrdata force-pushed the fix/csrf-post-feature-flag branch 2 times, most recently from 923dd15 to 89c0bf3 Compare April 22, 2026 13:02
… feature flag

Lets clients detect CSRF-POST backend support via ComfyUI core's feature_flags
instead of parsing version strings. Absence of the flag indicates a Manager
version < 4.2.1 that is incompatible with POST-only state-mutation endpoints.

Follow-up to #2818; no endpoint or security behavior change.
@ltdrdata ltdrdata force-pushed the fix/csrf-post-feature-flag branch from 89c0bf3 to 81935bd Compare April 22, 2026 13:03
@ltdrdata ltdrdata merged commit 01799f8 into manager-v4 Apr 22, 2026
9 checks passed
ltdrdata added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 22, 2026
Align with Comfy-Org/ComfyUI-Manager backend changes:
- #2818 (4.2.0): CSRF Content-Type gate + GET→POST migration for
  state-mutation endpoints.
- #2823 (4.2.1): register `extension.manager.supports_csrf_post`
  server feature flag so clients can detect POST-capable backends
  without version string parsing.

Service layer (comfyManagerService):
- Convert START_QUEUE, UPDATE_ALL, UPDATE_COMFYUI, REBOOT to POST
  with body=null and preserved query params. Backend's
  reject_simple_form_post gate allows body=null + axios default
  application/json header; only the three CORS simple-form types
  (x-www-form-urlencoded, multipart/form-data, text/plain) are
  rejected.

UI/state layer (useManagerState):
- Add ManagerUIState.INCOMPATIBLE — entered when the backend
  advertises supports_manager_v4 but not supports_csrf_post (old
  Manager that cannot handle the new POST endpoints). Manager UI
  is treated as "not installed": shouldShowManagerButtons returns
  false and consumers (TopMenuSection, MissingNodeCard,
  MissingPackGroupRow, TabErrors) hide their entry points without
  any call-site change.
- Graceful degraded mode while users remain on Manager <4.2.1:
  one-shot upgrade toast (warn, 15s) dispatched via
  watch(immediate:true) with a module-level guard that survives
  multiple composable instances; openManager() re-emits on explicit
  user action so stale shortcuts still surface guidance.
- i18n (en/ko) for the upgrade-required notification covering
  Desktop / standalone pip / Manager UI self-update paths.

Existing policies preserved:
- `--enable-manager` absent → DISABLED (unchanged).
- `--enable-manager-legacy-ui` → LEGACY_UI (unchanged).
- server feature flags not yet loaded (undefined) → NEW_UI
  transient fallback (unchanged).

Refs: Comfy-Org/ComfyUI-Manager#2818, Comfy-Org/ComfyUI-Manager#2823
ltdrdata added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 22, 2026
Align with Comfy-Org/ComfyUI-Manager backend changes:
- #2818 (4.2.0): CSRF Content-Type gate + GET→POST migration for
  state-mutation endpoints.
- #2823 (4.2.1): register `extension.manager.supports_csrf_post`
  server feature flag so clients can detect POST-capable backends
  without version string parsing.

Service layer (comfyManagerService):
- Convert START_QUEUE, UPDATE_ALL, UPDATE_COMFYUI, REBOOT to POST
  with body=null and preserved query params. Backend's
  reject_simple_form_post gate allows body=null + axios default
  application/json header; only the three CORS simple-form types
  (x-www-form-urlencoded, multipart/form-data, text/plain) are
  rejected.

UI/state layer (useManagerState):
- Add ManagerUIState.INCOMPATIBLE — entered when the backend
  advertises supports_manager_v4 but not supports_csrf_post (old
  Manager that cannot handle the new POST endpoints). Manager UI
  is treated as "not installed": shouldShowManagerButtons returns
  false and consumers (TopMenuSection, MissingNodeCard,
  MissingPackGroupRow, TabErrors) hide their entry points without
  any call-site change.
- Graceful degraded mode while users remain on Manager <4.2.1:
  one-shot upgrade toast (warn, 15s) dispatched via
  watch(immediate:true) with a module-level guard that survives
  multiple composable instances; openManager() re-emits on explicit
  user action so stale shortcuts still surface guidance.
- i18n (en/ko) for the upgrade-required notification covering
  Desktop / standalone pip / Manager UI self-update paths.

Existing policies preserved:
- `--enable-manager` absent → DISABLED (unchanged).
- `--enable-manager-legacy-ui` → LEGACY_UI (unchanged).
- server feature flags not yet loaded (undefined) → NEW_UI
  transient fallback (unchanged).

Refs: Comfy-Org/ComfyUI-Manager#2818, Comfy-Org/ComfyUI-Manager#2823
ltdrdata added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 22, 2026
Without this flag, the ManagerUIState resolver returns INCOMPATIBLE and
Comfy.OpenManagerDialog fires the upgrade toast instead of opening the
manager dialog, regressing all 9 tests in this spec.

Refs: Comfy-Org/ComfyUI-Manager#2823
ltdrdata added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 23, 2026
…g spec

`mockServerFeatures()` intercepts `/api/features` HTTP, but
`serverFeatureFlags` is populated exclusively via the WebSocket
`feature_flags` handler (src/scripts/api.ts:751-758), so the mock never
reaches `useManagerState`. Replace with the reactive-ref mutation
pattern documented in `shareWorkflowDialog.spec.ts:34-48` so that
`supports_v4` + `supports_csrf_post` are actually observable by the
INCOMPATIBLE gate introduced in this PR.

Without this, all 9 tests in this file regressed under the new gate:
the `OpenManagerDialog` command resolved to INCOMPATIBLE and fired the
upgrade toast instead of opening the dialog.

Refs: Comfy-Org/ComfyUI-Manager#2823
ltdrdata added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 23, 2026
Align with Comfy-Org/ComfyUI-Manager backend changes:
- #2818 (4.2.0): CSRF Content-Type gate + GET→POST migration for
  state-mutation endpoints.
- #2823 (4.2.1): register `extension.manager.supports_csrf_post`
  server feature flag so clients can detect POST-capable backends
  without version string parsing.

Service layer (comfyManagerService):
- Convert START_QUEUE, UPDATE_ALL, UPDATE_COMFYUI, REBOOT to POST
  with body=null and preserved query params. Backend's
  reject_simple_form_post gate allows body=null + axios default
  application/json header; only the three CORS simple-form types
  (x-www-form-urlencoded, multipart/form-data, text/plain) are
  rejected.

UI/state layer (useManagerState):
- Add ManagerUIState.INCOMPATIBLE — entered when the backend
  advertises supports_manager_v4 but not supports_csrf_post (old
  Manager that cannot handle the new POST endpoints). Manager UI
  is treated as "not installed": shouldShowManagerButtons returns
  false and consumers (TopMenuSection, MissingNodeCard,
  MissingPackGroupRow, TabErrors) hide their entry points without
  any call-site change.
- Graceful degraded mode while users remain on Manager <4.2.1:
  one-shot upgrade toast (warn, 15s) dispatched via
  watch(immediate:true) with a module-level guard that survives
  multiple composable instances; openManager() re-emits on explicit
  user action so stale shortcuts still surface guidance.
- i18n (en/ko) for the upgrade-required notification covering
  Desktop / standalone pip / Manager UI self-update paths.

Existing policies preserved:
- `--enable-manager` absent → DISABLED (unchanged).
- `--enable-manager-legacy-ui` → LEGACY_UI (unchanged).
- server feature flags not yet loaded (undefined) → NEW_UI
  transient fallback (unchanged).

Refs: Comfy-Org/ComfyUI-Manager#2818, Comfy-Org/ComfyUI-Manager#2823
ltdrdata added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 23, 2026
…g spec

`mockServerFeatures()` intercepts `/api/features` HTTP, but
`serverFeatureFlags` is populated exclusively via the WebSocket
`feature_flags` handler (src/scripts/api.ts:751-758), so the mock never
reaches `useManagerState`. Replace with the reactive-ref mutation
pattern documented in `shareWorkflowDialog.spec.ts:34-48` so that
`supports_v4` + `supports_csrf_post` are actually observable by the
INCOMPATIBLE gate introduced in this PR.

Without this, all 9 tests in this file regressed under the new gate:
the `OpenManagerDialog` command resolved to INCOMPATIBLE and fired the
upgrade toast instead of opening the dialog.

Refs: Comfy-Org/ComfyUI-Manager#2823
ltdrdata added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 23, 2026
Align with Comfy-Org/ComfyUI-Manager backend changes:
- #2818 (4.2.0): CSRF Content-Type gate + GET→POST migration for
  state-mutation endpoints.
- #2823 (4.2.1): register `extension.manager.supports_csrf_post`
  server feature flag so clients can detect POST-capable backends
  without version string parsing.

Service layer (comfyManagerService):
- Convert START_QUEUE, UPDATE_ALL, UPDATE_COMFYUI, REBOOT to POST
  with body=null and preserved query params. Backend's
  reject_simple_form_post gate allows body=null + axios default
  application/json header; only the three CORS simple-form types
  (x-www-form-urlencoded, multipart/form-data, text/plain) are
  rejected.

UI/state layer (useManagerState):
- Add ManagerUIState.INCOMPATIBLE — entered when the backend
  advertises supports_manager_v4 but not supports_csrf_post (old
  Manager that cannot handle the new POST endpoints). Manager UI
  is treated as "not installed": shouldShowManagerButtons returns
  false and consumers (TopMenuSection, MissingNodeCard,
  MissingPackGroupRow, TabErrors) hide their entry points without
  any call-site change.
- Graceful degraded mode while users remain on Manager <4.2.1:
  one-shot upgrade toast (warn, 15s) dispatched via
  watch(immediate:true) with a module-level guard that survives
  multiple composable instances; openManager() re-emits on explicit
  user action so stale shortcuts still surface guidance.
- i18n (en/ko) for the upgrade-required notification covering
  Desktop / standalone pip / Manager UI self-update paths.

Existing policies preserved:
- `--enable-manager` absent → DISABLED (unchanged).
- `--enable-manager-legacy-ui` → LEGACY_UI (unchanged).
- server feature flags not yet loaded (undefined) → NEW_UI
  transient fallback (unchanged).

Refs: Comfy-Org/ComfyUI-Manager#2818, Comfy-Org/ComfyUI-Manager#2823
ltdrdata added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 23, 2026
…g spec

`mockServerFeatures()` intercepts `/api/features` HTTP, but
`serverFeatureFlags` is populated exclusively via the WebSocket
`feature_flags` handler (src/scripts/api.ts:751-758), so the mock never
reaches `useManagerState`. Replace with the reactive-ref mutation
pattern documented in `shareWorkflowDialog.spec.ts:34-48` so that
`supports_v4` + `supports_csrf_post` are actually observable by the
INCOMPATIBLE gate introduced in this PR.

Without this, all 9 tests in this file regressed under the new gate:
the `OpenManagerDialog` command resolved to INCOMPATIBLE and fired the
upgrade toast instead of opening the dialog.

Refs: Comfy-Org/ComfyUI-Manager#2823
christian-byrne pushed a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 23, 2026
## Summary

Align `comfyManagerService` and Manager UI state with CSRF hardening in
[Comfy-Org/ComfyUI-Manager#2818](Comfy-Org/ComfyUI-Manager#2818)
(4.2.0, Content-Type gate + GET→POST migration) and
[Comfy-Org/ComfyUI-Manager#2823](Comfy-Org/ComfyUI-Manager#2823)
(4.2.1, `extension.manager.supports_csrf_post` feature flag).

## Changes

- **Service layer**: Convert 4 state-mutation endpoints (`START_QUEUE`,
`UPDATE_ALL`, `UPDATE_COMFYUI`, `REBOOT`) from GET to POST. `body=null`
+ axios default `Content-Type: application/json` is allowed by the
backend's `reject_simple_form_post` gate (only the three CORS
simple-form types are rejected).
- **UI/state layer**: Add `ManagerUIState.INCOMPATIBLE` triggered when
the backend advertises `supports_manager_v4` but not
`supports_csrf_post`. Manager UI is treated as "not installed" — buttons
hide via `shouldShowManagerButtons` with zero call-site changes across
`TopMenuSection`, `MissingNodeCard`, `MissingPackGroupRow`, `TabErrors`.
- **Graceful degraded mode**: One-shot upgrade toast (warn, 15s)
dispatched via `watch(immediate:true)` with a module-level guard that
survives multiple composable instances. `openManager()` re-emits on
explicit user action so stale shortcuts still surface guidance. i18n
(en/ko) covering Desktop / standalone pip / Manager UI self-update
paths.
- **Breaking**: None. Existing policies preserved (`--enable-manager`
absent → `DISABLED`; `--enable-manager-legacy-ui` → `LEGACY_UI`; feature
flags not yet loaded → `NEW_UI` transient fallback).

## Review Focus

- Decision-tree ordering in `useManagerState.ts`: `supports_csrf_post`
check evaluates before `NEW_UI`/`LEGACY_UI` branches so stale Manager
backends never reach the enabled paths.
- Toast guard: module-level `incompatibleToastShown` survives multiple
composable instances (tests verify 3× `useManagerState()` = 1 toast
call).
- `generatedManagerTypes.ts` still declares the 4 endpoints as GET;
regeneration follows once Manager 4.2.1 OpenAPI is published. Runtime is
unaffected since axios operates on the route string.

## References

-
[Comfy-Org/ComfyUI-Manager#2818](Comfy-Org/ComfyUI-Manager#2818)
— CSRF Content-Type gate + GET→POST migration (4.2.0)
-
[Comfy-Org/ComfyUI-Manager#2823](Comfy-Org/ComfyUI-Manager#2823)
— `supports_csrf_post` feature flag (4.2.1)
- [comfyui-manager 4.2.1 on
PyPI](https://pypi.org/project/comfyui-manager/4.2.1) — release package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant