Skip to content

Commit 2d13763

Browse files
committed
style(extensions): use yaml.safe_dump when writing catalog config
The catalog add/remove handlers wrote the integration catalog config with yaml.dump. Switch to yaml.safe_dump to align with the SafeDumper used by the presets commands and to refuse emitting !!python/object tags if a non-basic value ever reaches the config dict. Output is unchanged for the current basic-type payload (str/int/bool/dict/ list) — this is a defensive/consistency change, not a behavioral fix.
1 parent f040f76 commit 2d13763

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/specify_cli/extensions/_commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def catalog_add(
323323
})
324324

325325
config["catalogs"] = catalogs
326-
config_path.write_text(yaml.dump(config, default_flow_style=False, sort_keys=False, allow_unicode=True), encoding="utf-8")
326+
config_path.write_text(yaml.safe_dump(config, default_flow_style=False, sort_keys=False, allow_unicode=True), encoding="utf-8")
327327

328328
install_label = "install allowed" if install_allowed else "discovery only"
329329
console.print(f"\n[green]✓[/green] Added catalog '[bold]{name}[/bold]' ({install_label})")
@@ -363,7 +363,7 @@ def catalog_remove(
363363
raise typer.Exit(1)
364364

365365
config["catalogs"] = catalogs
366-
config_path.write_text(yaml.dump(config, default_flow_style=False, sort_keys=False, allow_unicode=True), encoding="utf-8")
366+
config_path.write_text(yaml.safe_dump(config, default_flow_style=False, sort_keys=False, allow_unicode=True), encoding="utf-8")
367367

368368
console.print(f"[green]✓[/green] Removed catalog '{name}'")
369369
if not catalogs:

tests/test_extension_update_hardening.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def mock_download_fail(*args, **kwargs):
111111

112112
def test_extension_update_skills_backup_no_collision(project_dir, monkeypatch):
113113
"""Regression: skills agents name every command file SKILL.md (one per
114-
per-command subdir). Backup must keep the per-command path so rollback
114+
command subdirectory). Backup must keep the per-command path so rollback
115115
restores each skill's own content instead of overwriting them onto a
116116
single backup path."""
117117
monkeypatch.chdir(project_dir)

0 commit comments

Comments
 (0)