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).
Summary
Found during the #87 escaping work (task t9 of the fifteen-issue sweep, PR pending).
devague/render/_md_safety.pynow has two independent transforms that rendererscompose:
autolink_urls(text)— wraps a barehttp(s)://…in<…>to satisfy MD034.md_safe_text(text)— wraps underscore/dunder identifiers in code spans andescapes remaining markdown control characters (new in this release, export renders claim text unescaped — underscore identifiers make the spec fail markdownlint (MD037) #87).
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 wherethe 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
through the real renderer, asserting the link survives intact and the output
lints clean.
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), andsummary_md.py(t13).