Skip to content

v0.1.8 — ReDoS fixes

Choose a tag to compare

@olibaron olibaron released this 01 Sep 11:00
· 38 commits to main since this release

Security release. Four Markdown scanners ran in polynomial time on inputs that are ordinary Markdown, reported by CodeQL as high-severity polynomial ReDoS (js/polynomial-redos).

Supersedes v0.1.6 and v0.1.7, which were tagged but never reached npm. Everything in them is included here.

Fixed

Scanner Before After
Table detection 64 s on 8 KB < 1 ms on 80 KB
Fenced-range collection quadratic 3.4 ms on 20k fences
Bracket-math conversion quadratic 1.8 ms on 20k lines
Reasoning-tag splitting quadratic 0.1 ms on 20k tags

Table detection was the one that mattered most in practice: its trigger is an unterminated final line, which is the normal shape of a table part-way through a stream, so a pipe-dense row could stall the renderer without any hostile input at all. If you stream tables, upgrade.

All four now share a single linear line index. splitReasoning additionally moved to indices, dropping an O(n²) from its repeated slicing.

Also includes a KaTeX handling fix for word animation and loading-indicator style adjustments.

Compatibility

No API changes. Each scanner was fuzzed against the regex it replaced over ~30k generated inputs — including repairTableSyntax and convertMath end to end — so output is byte-identical, including two quirks of the old fence pattern that are now pinned by tests (it matches neither an empty fence nor a CRLF closing line).

Full Changelog: v0.1.5...v0.1.8