Skip to content

Commit 2ae702c

Browse files
iamaeroplaneclaude
andcommitted
fix(extensions): guard against non-dict command entries in _validate()
If provides.commands contains a non-mapping entry (e.g. an int or string), 'name' not in cmd raises TypeError instead of a user-facing ValidationError. Added isinstance(cmd, dict) check at the top of the loop. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5d5b02f commit 2ae702c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/specify_cli/extensions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ def _validate(self):
219219
# Validate commands; track renames so hook references can be rewritten.
220220
rename_map: Dict[str, str] = {}
221221
for cmd in commands:
222+
if not isinstance(cmd, dict):
223+
raise ValidationError(
224+
"Each command entry in 'provides.commands' must be a mapping"
225+
)
222226
if "name" not in cmd or "file" not in cmd:
223227
raise ValidationError("Command missing 'name' or 'file'")
224228

0 commit comments

Comments
 (0)