Skip to content

fix: escape Rich markup in catalog list output - #3738

Merged
mnriem merged 1 commit into
github:mainfrom
Noor-ul-ain001:fix/catalog-list-markup-escape
Jul 27, 2026
Merged

fix: escape Rich markup in catalog list output#3738
mnriem merged 1 commit into
github:mainfrom
Noor-ul-ain001:fix/catalog-list-markup-escape

Conversation

@Noor-ul-ain001

Copy link
Copy Markdown
Contributor

Summary

The catalog list subcommands print user-editable catalog fields (name, url, description from the *-catalogs.yml config files) through console.print, which has Rich markup enabled. Any bracketed content is parsed as a style tag and silently swallowed — e.g. a catalog description Does [stuff] nicely renders as Does nicely — and a malformed tag can raise while rendering.

This affects four commands whose sibling extension catalog list already escapes these fields:

  • specify workflow catalog list (workflows/_commands.py)
  • specify workflow step catalog list (workflows/_commands.py)
  • specify preset catalog list (presets/_commands.py)
  • specify integration catalog list (integrations/_query_commands.py)

Fix

Route each untrusted field through the module's already-imported escape helper (from rich.markup import escape), matching the reference pattern in extension catalog list. No new imports.

Tests

Adds a regression test per command that injects bracketed name/url/description and asserts the brackets survive verbatim in the output. Confirmed each test fails without the corresponding source fix (test-the-test via stash).

The 20 unrelated test_workflows.py symlink-guard failures in my local run are pre-existing Windows-without-elevation failures, not touched by this change.

🤖 Generated with Claude Code

The `catalog list` subcommands for workflows, workflow steps, presets,
and integrations printed user-editable catalog fields (name/url/
description from the `*-catalogs.yml` files) through `console.print`
with Rich markup enabled. Any bracketed content such as a description
`Does [stuff] nicely` was parsed as a style tag and silently swallowed,
and a malformed tag could raise while rendering.

Route each untrusted field through the module's already-imported
`escape` helper, matching the pattern already used by
`extension catalog list`.

Adds regression tests for all four commands that inject bracketed
name/url/description and assert the brackets survive verbatim in the
output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Escapes user-controlled catalog metadata before Rich rendering, preserving bracketed content across catalog-list commands.

Changes:

  • Escapes catalog names, URLs, and descriptions in four CLI commands.
  • Adds regression coverage for each affected command.
Show a summary per file
File Description
src/specify_cli/workflows/_commands.py Escapes workflow and step catalog fields.
src/specify_cli/presets/_commands.py Escapes preset catalog fields.
src/specify_cli/integrations/_query_commands.py Escapes integration catalog fields.
tests/test_workflows.py Tests workflow and step output.
tests/test_presets.py Tests preset output.
tests/integrations/test_integration_catalog.py Tests integration output.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Medium

@mnriem
mnriem merged commit 99dc915 into github:main Jul 27, 2026
14 checks passed
@mnriem

mnriem commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants