Files
open-webui/src/lib/utils
Classic298andZureno 5278eb906e fix: block external resource loading in Vega chart rendering to prevent client-side SSRF (#26806)
* fix: block external resource loading in Vega chart rendering to prevent client-side SSRF

renderVegaVisualization renders vega/vega-lite chart specs that appear in untrusted chat content (shared chats, channel messages, assistant/RAG/tool output) by constructing a Vega View with no restricted loader, so a crafted spec could make a viewer's browser issue arbitrary outbound requests. There are two paths: data.url (and topojson/geo data) is fetched via loader.load at view construction, and image-mark urls are resolved via loader.sanitize and emitted as <image href> into the output SVG, fetched by the browser when the SVG is displayed. Both are client-side SSRF, and against same-origin or CORS-permissive targets allow reading the response back into the page. Pass a loader that rejects external resource loads on both paths, load throws and sanitize rejects http(s)/protocol-relative URIs, so rendered charts can only use inline data. Inline data.values charts are unaffected.

Co-authored-by: Zureno <Zureno@users.noreply.github.com>

* fix: resolve Vega image urls with the URL parser before blocking external loads

The previous scheme regex could be bypassed with encodings the browser URL parser
normalizes away, such as a leading tab or newline before the scheme and backslash
variants of protocol-relative urls like /\evil.com, which would still be emitted
into the rendered SVG and fetched externally on display. Resolve the uri against
document.baseURI with the browser's own URL parser and only allow data: uris and
same-origin results, so the check cannot diverge from what the browser would
actually fetch. Also shortens the explanatory comments.

---------

Co-authored-by: Zureno <Zureno@users.noreply.github.com>
2026-07-27 03:03:30 -04:00
..
2026-07-27 02:47:09 -04:00
2024-03-24 15:28:36 -07:00
2024-06-09 14:25:31 -07:00
2026-05-09 04:22:46 +09:00
2026-07-26 21:12:14 -04:00
2026-03-06 20:12:37 -06:00
2026-03-23 23:39:52 -05:00
2026-05-11 02:29:13 +09:00
2026-03-06 20:12:37 -06:00
2024-12-16 15:11:05 -05:00
2026-06-01 13:56:55 -07:00
2026-04-12 19:13:13 -05:00
2026-03-06 20:12:37 -06:00
2026-07-17 06:28:07 -04:00
2025-11-19 03:51:10 -05:00