Files
orca/src/renderer
73255f3c59 Fix renderer freeze (ReDoS) from terminal link detection on ngrok/ConPTY output (#5970) (#6373)
* Fix ReDoS in terminal file-path link detection that froze the app (#5970)

A full-screen TUI such as ngrok, run through Windows ConPTY, emits its
dashboard as a single newline-free logical line that is almost entirely
alignment spaces. xterm accumulates it into one ~150k-char logical line,
and on every hover/redraw Orca's file-path link providers scan that line.

The spaced-path lookaheads (SPACED_PATH_WITH_SEPARATOR_REGEX and
LINE_ENDING_SPACED_PATH_REGEX) began with `[^...]*\s+`, where the negated
character class also matches whitespace. That overlap let the engine split
a long run of spaces in exponentially many ways before failing, so a
~5k-char prefix took ~25s and pegged the renderer main thread, freezing
the whole app. macOS uses a normal PTY and never builds that line, so it
was unaffected; disabling terminal GPU acceleration did not help.

Anchor the first lookahead segment at the first whitespace (add `\s` to
the negated class) so it can no longer overlap the following `\s+`. The
matches are identical; the scan drops from ~25,000ms to ~4ms.

Adds a regression test asserting extraction stays roughly linear on long
space-heavy lines.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Fix terminal link ReDoS guards

* Trim terminal link padding

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com>
Co-authored-by: Neil <neil@stably.ai>
2026-06-25 15:04:24 -07:00
..
2026-03-17 01:40:24 -07:00
2026-05-30 13:09:17 -07:00