An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:lock: https://github.com/siyuan-note/siyuan/security/advisories/GHSA-x63q-3rcj-hhp5
Danielbb326aa992b2
diff --git a/app/src/protyle/render/mermaidRender.ts b/app/src/protyle/render/mermaidRender.tsindex 1ff7c81c2c..6f2cbf73b8 100644--- a/app/src/protyle/render/mermaidRender.ts+++ b/app/src/protyle/render/mermaidRender.ts@@ -98,7 +98,15 @@ const initMermaid = (mermaidElements: Element[]) => {try {renderElement.innerHTML = `<span style="position: absolute;left:0;top:0;width: 1px;">${Constants.ZWSP}</span><div contenteditable="false"><span id="${id}"></span></div>`;const mermaidData = await window.mermaid.render(id, Lute.UnEscapeHTMLStr(item.getAttribute("data-content")));- renderElement.lastElementChild.innerHTML = mermaidData.svg.replace(/(href|src|xlink:href)\s*=\s*["']\\\\/gi, (match, p1) => `${p1}="about:blank"`);;+ let svg = mermaidData.svg.replace(/(href|src|xlink:href)\s*=\s*["']\\\\/gi, (match, p1) => `${p1}="about:blank"`);+ svg = window.DOMPurify.sanitize(svg, {+ USE_PROFILES: { svg: true, svgFilters: true },+ ADD_TAGS: ['foreignObject', 'use', 'style'],+ ADD_ATTR: ['dominant-baseline', 'xlink:href', 'href'], // 保留对齐和链接属性+ // 必须添加此项,否则 foreignObject 里的 HTML 内容会被清空+ HTML_INTEGRATION_POINTS: { foreignobject: true }+ });+ renderElement.lastElementChild.innerHTML = svg;} catch (e) {const errorElement = document.querySelector("#" + id);renderElement.lastElementChild.innerHTML = `${errorElement.outerHTML}<div class="fn__hr"></div><div class="ft__error">${e.message.replace(/\n/, "<br>")}</div>`;diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 9224c9cf05..05f2e18092 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -154,7 +154,7 @@ interface CSSStyleDeclarationElectron extends CSSStyleDeclaration {interface Window {DOMPurify: {- sanitize(dirty: string): string;+ sanitize(dirty: string, options?: any): string;};echarts: {init(element: Element, theme?: string, options?: {