Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

5.7 KB
Raw Blame

Hardened how the web frontend renders HTML and Markdown.

  • Markdown (research reports, chat, notes and news findings) no longer renders raw HTML written in the Markdown source; it is shown as literal text. Content that deliberately embedded HTML, such as a <details> block, now displays the tags as text. The app's own report text no longer uses raw HTML: the error report for a failed research shows its partial results under a plain Markdown heading instead of a <details> block, and the HTML comment a detailed report places before its Sources list is removed when the report is saved, assembled for viewing or export, or used as news findings. It used to stay in reports saved with the "no hyperlinks" citation format or after a citation formatting error, and reports already saved that way are cleaned the same way when they are assembled or used as news findings.
  • Markdown output is sanitized against an explicit allowlist (Markdown and GFM elements, tables, task-list checkboxes, links, images, and KaTeX's HTML, MathML and SVG output) instead of DOMPurify's default allowlist, and data-* attributes from the Markdown are dropped. A second pass then removes any <input> other than a checkbox and makes checkboxes display-only; rebuilds each inline style from the declarations the browser parsed, keeping only a fixed list of KaTeX layout and color properties whose values validate, so any other declaration (a url(...) value or position: fixed, for example) is dropped; keeps only class names on a renderer allowlist (KaTeX, syntax-highlighting tokens, GFM task lists and language-* code-block classes); and prefixes an id or name that matches an application global. That last step is defence in depth: no author-controlled id or name reaches it today.
  • Markdown ![alt](url) images keep only src, alt and title. The source must be http(s), ftp(s), a relative URL, or a PNG, JPEG, GIF, WebP or BMP data: URL; an SVG or any other data: type removes the image. Remote images were already blocked by the Content-Security-Policy (img-src 'self' data:) and still are, so the images that display are same-origin ones and those raster data: images.
  • Generated-image references (![ref:image-*]) expand only when one stands alone as a paragraph; a reference inside a sentence, a link title or code is left as written. The image markup is built with DOM APIs, and the result is sanitized again before display.
  • Markdown rendering falls back to escaped plain text when XSSProtection.sanitizeStable is unavailable, as it already did without marked or a supported DOMPurify.
  • sanitizeHtml(), safeSetInnerHTML(), services/ui.js's safeSetHTML() and renderMarkdown() now sanitize to a fixpoint: DOMPurify runs again until its output stops changing (sanitize(s) === s), so the tree the browser builds from the emitted string is one DOMPurify has already cleared under the same configuration. Markup still changing after five passes is shown as escaped text. Other direct DOMPurify call sites, such as PDF export (#7365) and semantic-search snippets, still sanitize once.
  • safeSetHTML() (loading spinners, error banners and alerts) now sanitizes with the shared restrictive allowlist instead of DOMPurify's default profile, and shows text when window.sanitizeHtml is unavailable.
  • Research results and the research-details panels no longer blank out parts of text that look like template syntax (}}, ${...}, %>), such as nested JSON in an error message or a ${VAR} shell example in a report.
  • News feed card actions (the card menu, votes, save, subscribe and "View Full Report") now run only from the controls the feed rendered in each card's own menu and footer. A lookalike control inside a card's findings, or one added after rendering, triggers no card action, and each vote button's direction is fixed when the card is rendered.
  • The shared DOMPurify link hook also rewrites a named link target (any value except _self, _parent and _top) to _blank and gives it rel="noopener noreferrer", so a sanitized link cannot select another open window by name. xss-protection.js installs this hook when it loads, and the bundle installs it after publishing DOMPurify if xss-protection.js already ran; installing it twice does nothing. Pages built on the base template run the bundle first, so there xss-protection.js installs it. Either way, call sites that use DOMPurify directly after both scripts have run get the hook.
  • safeCreateElement() now sets only allowlisted attributes (plus aria-* and data-*), accepts an href only if it is http(s), mailto, tel or relative (protocol-relative //host and backslash forms are rejected), and adds rel="noopener noreferrer" to links that open a new window. It has no call sites today, so this protects future callers only.
  • The context-overflow panel coerces truncation rates and average response times to numbers before rendering, and the collection upload page URI-encodes the collection id in its "View Collection" link.
  • New Vitest security suites cover these render paths, including an mXSS reparse suite. It runs in happy-dom, which has no MathML foreign-content support, so its MathML namespace-confusion cases are regression coverage only; see the suite header. The Python client-side sink checks were extended; a new check parses every template and fails unless each call of the help_tip macro, which renders its text with |safe, passes string literals, whether the macro is called by name, through an import alias or through a namespace import; and the real-browser mXSS suite from #6338 now checks that author-supplied MathML stays literal text.