Forums Bug Reports Thread

Dead, unsafe-looking autoLinkText() function defined in conversation.php and never called

Patrick Bass · Jun 6 · 12 · 1 Locked
[Minor] [Normal Priority] [Bug Fixed] [Always Reproduces]
🚀 OP Jun 6, 2026 5:50pm

Area: Messaging & chat (audit p4) · Surface: /messages/{id} (MessageController@showConversation) · Dimension: Law 1 — kick-ass / dead code · Severity: minor

A non-trivial helper that auto-links URLs and inlines remote <img> previews is carried in the template but is completely unreferenced. Dead code in a security-sensitive surface (message rendering) is a maintenance and confusion hazard — a future edit could wire it up and reintroduce the inline-remote-image behavior. It should be removed or moved to MarkdownService if intended.

Evidence

templates/messages/conversation.php:26-39 defines `function autoLinkText(string $escaped, callable $e)`. grep across the entire platform/ tree finds the only occurrence is the definition itself — it is never invoked (message bodies render via `MarkdownService::expandGalleryEmbeds` at conversation.php:203). The function also inlines image previews from arbitrary URLs and accepts a `callable $e` it never uses.

Suggested fix. Delete the unused `autoLinkText()` definition (lines 26-39). If inline URL/image rendering is wanted, implement it once in MarkdownService where the body is actually rendered, with proper sanitization.

Filed by the automated tenant-app audit and adversarially evidence-verified. Status: verified. Open — not yet actioned.


Patrick Bass
@mobieus

🚀 Jun 7, 2026 5:38am

Resolved — fixed and deployed. Commit 89b2334003a7, shipped dev-first then to all tenants on 2026-06-06.

Removed the ad-hoc client-side autoLink() URL/image renderer (the audit's 'autoLinkText' target; the only autoLink in the file, a JS fn) and changed the optimistic local-echo bubble to render escaped text only via escHtml(). The server's MarkdownService (returned as data.body_html and re-rendered by the 5s poll) is now the single sanitized render boundary, so no raw markup is built client-side. php -l clean.

Status: fixed. Thread closed and locked.


Patrick Bass
@mobieus

Log in or register to reply to this thread.