Advisory

GHSA-fpw4-p57j-hqmq

Details, part 2 of 2. The advisory

Details

Recommended Fix

The minimum fix is to remove the urlTransform override in ui/src/components/MarkdownBody.tsx:162 and rely on react-markdown's defaultUrlTransform:

// ui/src/components/MarkdownBody.tsx
import Markdown, { defaultUrlTransform, type Components } from "react-markdown";

// ...

// Preserve mention-chip (paperclip-mention://) hrefs so parseMentionChipHref still runs,
// but fall back to the library's scheme allow-list for everything else.
function safeUrlTransform(url: string): string {
  if (url.startsWith("paperclip-mention://")) return url;
  return defaultUrlTransform(url);
}

<Markdown
  remarkPlugins={[remarkGfm]}
  components={components}
  urlTransform={safeUrlTransform}
>
  {children}
</Markdown>

defaultUrlTransform strips javascript:, vbscript:, file:, and non-image data: URIs, which closes this finding for every call site of MarkdownBody.

Defense-in-depth recommendations:

  1. Add a strict Content-Security-Policy header to the main app response (e.g. script-src 'self' 'nonce-...') so that even a future regression cannot execute inline JS via javascript: navigation.
  2. Server-side validate document and comment bodies for obviously unsafe markdown patterns (e.g. reject ](javascript: sequences) as belt-and-braces. Do not rely on client-side sanitization alone, since other clients (mobile, exports) may render the same content.
  3. Audit every existing component for other urlTransform/skipHtml/rehype-raw overrides that might reintroduce the same bypass.

Sources & licences