From 33d8fac2885843f28879087a9f51f4382eefa52e Mon Sep 17 00:00:00 2001 From: marcelsafin <179933638+marcelsafin@users.noreply.github.com> Date: Wed, 12 Aug 2026 23:53:46 +0200 Subject: [PATCH] fix(bundler): reject non-string catalog tags Assisted-by: GitHub Copilot (model: gpt-5.6-sol, autonomous) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/specify_cli/bundler/models/catalog.py | 6 +++++- tests/contract/test_catalog_schema.py | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/specify_cli/bundler/models/catalog.py b/src/specify_cli/bundler/models/catalog.py index 53e83a52e7..b293954c51 100644 --- a/src/specify_cli/bundler/models/catalog.py +++ b/src/specify_cli/bundler/models/catalog.py @@ -117,7 +117,11 @@ def _parse_tags(value: Any, entry_id: str) -> tuple[str, ...]: raise BundlerError( f"Catalog entry '{entry_id}': 'tags' must be a list of strings." ) - return tuple(str(t) for t in value) + if any(not isinstance(tag, str) for tag in value): + raise BundlerError( + f"Catalog entry '{entry_id}': 'tags' must be a list of strings." + ) + return tuple(value) def _parse_verified(value: Any, entry_id: str) -> bool: diff --git a/tests/contract/test_catalog_schema.py b/tests/contract/test_catalog_schema.py index 15a844118b..0e360ac1aa 100644 --- a/tests/contract/test_catalog_schema.py +++ b/tests/contract/test_catalog_schema.py @@ -238,6 +238,15 @@ def test_catalog_entry_rejects_string_tags(): CatalogEntry.from_dict(data) +def test_catalog_entry_rejects_non_string_tag_members(): + from specify_cli.bundler.models.catalog import CatalogEntry + + data = catalog_entry_dict("demo") + data["tags"] = ["valid", 1] + with pytest.raises(BundlerError, match="'tags' must be a list of strings"): + CatalogEntry.from_dict(data) + + def test_catalog_entry_rejects_non_boolean_verified(): from specify_cli.bundler.models.catalog import CatalogEntry