Skip to content

Bug: catalog URL validation accepts control characters and malformed percent escapes #26

Closed

Description

@drevendev

Reproduced

Review baseline c2cbcf07ae67263ec7dbeb7cfb5822ea65b49c38, 2026-10-19, Python 3.13.5.
tools/catalog.py, blob db02dd26a6d0fea6e9d782aead5a8db12f44fdba.

For an otherwise valid resource, validate() returns no errors for both:

  • https://example.org/%ZZ
  • a URL containing a literal NUL in its path: Python string 'https://example.org/a\x00b' (JSON representation uses \u0000).

The tool's contract lists malformed HTTPS URLs as errors. urlsplit() separates components but is not a complete URL validator; checking whitespace and a few delimiters does not cover these inputs. The generated document can therefore contain a malformed destination despite a structural PASS.

Priority / scope

P2 correctness. This is not a request for network fetching, redirect checks, a destination-security score, or a full internationalized-URL implementation.

Acceptance

  • Define the supported URL syntax explicitly and reject raw control characters and invalid percent-escape sequences before normalization/rendering.
  • Add regressions for literal NUL/other controls, %ZZ, incomplete % escapes, and valid percent-encoded paths.
  • Preserve meaningful query strings, supported IPv6 URLs and current duplicate-source normalization behavior.
  • Do not accidentally forbid fragments in the core catalog: its existing contract intentionally ignores them for duplicate-source detection.
  • Run the full catalog tests, regeneration/check and repository checks.

Primary reference: https://docs.python.org/3/library/urllib.parse.html#url-parsing-security .

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions