fix(security): close remaining GHSA gaps from security triage

Block scheme-prefixed loopback storage checks, validate Notion attachment
URLs, sanitize wiki markdown HTML, and require MCP_SERVER_AUTH_TOKEN for
network MCP transports.
This commit is contained in:
wizardchen
2026-07-02 14:58:19 +08:00
committed by lyingbug
parent f23c674bad
commit cd65665894
9 changed files with 158 additions and 13 deletions
@@ -649,7 +649,8 @@ const wikiDrawerContent = computed(() => {
return `<a href="#" class="wiki-content-link citation-wiki" data-slug="${escapeHtml(slug)}">${escapeHtml(display)}</a>`;
});
return wrapChatMarkdownTables(marked.parse(preprocessed, { breaks: true, async: false }) as string);
const html = marked.parse(preprocessed, { breaks: true, async: false }) as string;
return sanitizeMarkdownHTML(wrapChatMarkdownTables(html));
});
watch(wikiDrawerContent, async () => {
@@ -699,7 +699,7 @@ import { useI18n } from 'vue-i18n'
import { marked } from 'marked'
import { MessagePlugin } from 'tdesign-vue-next'
import { RecycleScroller } from 'vue-virtual-scroller'
import { hydrateProtectedFileImages } from '@/utils/security'
import { hydrateProtectedFileImages, sanitizeMarkdownHTML } from '@/utils/security'
import picturePreview from '@/components/picture-preview.vue'
import WikiFolderActions from './WikiFolderActions.vue'
import { createSessions } from '@/api/chat'
@@ -1398,8 +1398,8 @@ function renderMarkdown(content: string): string {
return `<a href="#" class="wiki-content-link" data-slug="${slug}">${display}</a>`
})
// Use marked to render the markdown to HTML
return marked.parse(preprocessed, { breaks: true, async: false }) as string
const html = marked.parse(preprocessed, { breaks: true, async: false }) as string
return sanitizeMarkdownHTML(html)
}
async function openGraphDrawer(slug: string) {