Skip to content

catalog url validator leaks raw ValueError on a malformed URL #3434

Description

@Quratulain-bilal

description

CatalogStackBase._validate_catalog_url in src/specify_cli/catalogs.py reads parsed.hostname on the catalog url. urlparse/hostname raise ValueError on a malformed authority (e.g. an unclosed ipv6 bracket https://[::1, or a bracketed non-ip host https://[not-an-ip]), so instead of the clean catalog error every other reject path in that method produces, a raw ValueError escapes.

this reaches user input via specify integration catalog add <url>.

repro:

from specify_cli.catalogs import IntegrationCatalog
IntegrationCatalog._validate_catalog_url("https://[::1")  # ValueError: Invalid IPv6 URL

expected: the normal catalog error, like the non-https and host-less cases already raise.

twin of the bundler validator issue #3432.

note: i used an ai assistant to help investigate and write this up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions