fix(bundler): reject non-string catalog entry tag members - #4318
Open
Noor-ul-ain001 wants to merge 1 commit into
Open
fix(bundler): reject non-string catalog entry tag members#4318Noor-ul-ain001 wants to merge 1 commit into
Noor-ul-ain001 wants to merge 1 commit into
Conversation
_parse_tags in bundler/models/catalog.py rejected a non-list `tags`
value but silently coerced individual non-string members via
`str(t) for t in value`, letting a catalog entry like
`tags: [1, true, {}]` through as `("1", "True", "{}")` instead of
raising. This is the exact sibling of the bug just fixed for the
manifest's `_parse_str_list` in github#4091 (bundler/models/manifest.py) —
same file family, same shape, just not swept across both call sites.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FW9fAYsCBCAgdKWovtSyqt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_parse_tagsinsrc/specify_cli/bundler/models/catalog.pyvalidates that a catalog entry'stagsfield is a list/tuple, but then silently coerces each member withstr(t) for t in value— sotags: [1, true, {}]becomes("1", "True", "{}")instead of being rejected._parse_str_list(src/specify_cli/bundler/models/manifest.py), which rejects non-string list members with'{field}' must be a list of strings. The catalog's_parse_tagssibling wasn't updated in that PR, even though catalogs are explicitly untrusted input (per its own docstring).Test plan
test_catalog_entry_rejects_non_string_tag_memberstotests/contract/test_catalog_schema.py, mirroring the existingtest_catalog_entry_rejects_string_tags.DID NOT RAISE BundlerError) and passes with it.tests/contract/test_catalog_schema.py— 21 passed; the remaining 22 errors are pre-existing Windowstmp_path/PermissionError: WinError 5environment failures unrelated to this change (reproduced on an unmodified checkout).Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01FW9fAYsCBCAgdKWovtSyqt