Skip to content

autolink_urls and md_safe_text compose without knowing about each other — a URL containing an underscore can be corrupted #94

Description

@OriNachum

Summary

Found during the #87 escaping work (task t9 of the fifteen-issue sweep, PR pending).
devague/render/_md_safety.py now has two independent transforms that renderers
compose:

Neither knows about the other. A URL whose host or path contains an underscore
— e.g. https://example.com/some_path/file_name — is a plausible input where
the identifier-wrapping pass could reach inside the token the autolink pass
just produced, corrupting the link.

Status: theoretical, not observed

No test in the repo exercises the combination, and no acceptance criterion in
the sweep required it, so this is an unverified hazard rather than a reproduced
bug. It is filed because it was spotted while the composition was being
introduced, and it will be much cheaper to settle now than after a downstream
repo hits it.

What would close this

  • A test that renders a claim whose text contains an underscore-bearing URL
    through the real renderer, asserting the link survives intact and the output
    lints clean.
  • If it does corrupt: make the two passes composable (a single tokenizer that
    carves out URLs and code spans once, then escapes only what remains), rather
    than ordering them and hoping.

Provenance

Flagged by the t9 task agent in the sweep run for
#85; the same composition
landed in spec_md.py (t3), plan_md.py (t9), and summary_md.py (t13).

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