The vulnerability advisory explicitly mentioned that Open WebUI renders Mermaid blocks from Markdown files and injects the generated SVG into the DOM using innerHTML. The core of the issue is that Mermaid was configured with securityLevel: 'loose', which does not sanitize the output SVG. By comparing the git tags of the last vulnerable version (v0.9.5) and the first patched version (v0.9.6), I identified the fixing commit bf6325ff337aa131495a87a15333dc1773f2ff1f. This commit modifies the renderMermaidDiagram function in src/lib/utils/index.ts to sanitize the SVG output using DOMPurify before returning it. This confirms that renderMermaidDiagram was the vulnerable function, as it was processing potentially malicious Mermaid code and returning unsanitized SVG, which would then be rendered by a component like FilePreview.svelte, triggering the XSS.