ComfyUI/tests-unit/assets_test
Matt Miller 96e0e3585b
Some checks are pending
Detect Unreviewed Merge / detect (push) Waiting to run
Python Linting / Run Ruff (push) Waiting to run
Python Linting / Run Pylint (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Waiting to run
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Waiting to run
Execution Tests / test (macos-latest) (push) Waiting to run
Execution Tests / test (ubuntu-latest) (push) Waiting to run
Execution Tests / test (windows-latest) (push) Waiting to run
Test server launches without errors / test (push) Waiting to run
Unit Tests / test (macos-latest) (push) Waiting to run
Unit Tests / test (ubuntu-latest) (push) Waiting to run
Unit Tests / test (windows-2022) (push) Waiting to run
security: fix four vulnerabilities (GHSA-779p-m5rp-r4h4) (#14734)
* security: fix five vulnerabilities (GHSA-779p-m5rp-r4h4)

- CVE-2026-56670: force download of SVG/XML responses on /view to prevent stored XSS
- CVE-2026-56671: contain /experiment/models/preview reads within the model folder
- CVE-2026-56672: stop inline rendering of uploaded /userdata/{file} content
- CVE-2026-56673: prevent path traversal in get_annotated_filepath (LoadImage /prompt input)
- CVE-2026-56674: reject opaque/null Origin to close the CSRF middleware bypass

Adds regression tests under tests-unit/security_test/ covering all five.

* security: address review feedback on GHSA-779p fixes

- Fix Windows CI failure in test_get_annotated_filepath: compare against
  os.path.abspath(...) to match the intentional abspath normalization added
  by the traversal hardening (abspath prepends the drive letter on Windows).
- origin_check: narrow the bare `except:` in is_loopback() to ValueError so
  genuine interrupts aren't swallowed (review nit).
- origin_check: guard .port access in is_cross_origin_forbidden() so a
  malformed/out-of-range port (e.g. Origin: http://127.0.0.1:99999) fails
  closed with a 403 instead of surfacing an uncaught 500 in the middleware.
- server /view: escape backslash/quote in the Content-Disposition filename
  (RFC 6266 quoted-string) so a filename containing a double quote can't
  malform the response header.

* security: address CodeRabbit review feedback on GHSA-779p tests

- test #3: guard the symlink-escape test with a try/except skip so it no
  longer errors on Windows CI where os.symlink needs elevated privileges /
  Developer Mode (mirrors the guard in the sibling test #2).
- test #5: refresh the stale module docstring to describe the actual /view
  gating (view_image closure calling folder_paths.is_dangerous_content_type,
  the normalising check) instead of the bypassable raw set-membership test.

* revert(security): drop CVE-2026-56674 Origin: null CSRF change

Per maintainer review, the reported CSRF is already mitigated by the pre-existing
Sec-Fetch-Site: cross-site check for current browsers, and the null-origin
rejection risked breaking legitimate sandboxed-iframe embeds. Restores
origin_only_middleware and is_loopback in server.py to their prior state
(the Sec-Fetch-Site check is retained) and removes utils/origin_check.py and its
regression test. The other four GHSA-779p fixes are unaffected.
2026-07-02 20:44:54 -07:00
..
queries revert(assets): drop job_ids filter from GET /api/assets (#14408) 2026-06-10 19:23:01 -07:00
services feat(assets): cursor-based pagination on GET /api/assets (#14014) 2026-06-09 21:14:03 -07:00
conftest.py fix(assets): remove unused delete_content param from deleteAsset (#14241) 2026-06-09 21:52:14 -07:00
helpers.py Emit hash alongside asset_hash on all Asset responses (#13739) 2026-05-25 11:21:35 -07:00
test_assets_missing_sync.py Emit hash alongside asset_hash on all Asset responses (#13739) 2026-05-25 11:21:35 -07:00
test_crud.py fix(assets): remove unused delete_content param from deleteAsset (#14241) 2026-06-09 21:52:14 -07:00
test_downloads.py security: fix four vulnerabilities (GHSA-779p-m5rp-r4h4) (#14734) 2026-07-02 20:44:54 -07:00
test_file_utils.py refactor(assets): modular architecture + async two-phase scanner & background seeder (#12621) 2026-03-07 20:37:25 -05:00
test_list_cursor.py feat(assets): cursor-based pagination on GET /api/assets (#14014) 2026-06-09 21:14:03 -07:00
test_list_filter.py Emit hash alongside asset_hash on all Asset responses (#13739) 2026-05-25 11:21:35 -07:00
test_metadata_filters.py Assets Part 2 - add more endpoints (#12125) 2026-01-31 02:22:05 -05:00
test_prompt_id_enforcement.py revert(assets): drop job_ids filter from GET /api/assets (#14408) 2026-06-10 19:23:01 -07:00
test_prune_orphaned_assets.py refactor(assets): modular architecture + async two-phase scanner & background seeder (#12621) 2026-03-07 20:37:25 -05:00
test_sync_references.py chore(assets): drop vestigial tags.tag_type column (#14248) 2026-06-09 21:07:10 -07:00
test_tags_api.py fix(assets): remove unused delete_content param from deleteAsset (#14241) 2026-06-09 21:52:14 -07:00
test_uploads.py Emit hash alongside asset_hash on all Asset responses (#13739) 2026-05-25 11:21:35 -07:00