Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:lock: Do not execute scripts in serving SVG by default to prevent XSS https://github.com/siyuan-note/siyuan/issues/16844

Daniel5c0cc375b475
diff --git a/kernel/api/icon.go b/kernel/api/icon.go
index c0d56123de..f6f629ebc1 100644
--- a/kernel/api/icon.go
+++ b/kernel/api/icon.go
@@ -164,6 +164,10 @@ func getDynamicIcon(c *gin.Context) {
svg = generateTypeOneSVG(color, lang, dateInfo)
}
+ if !model.Conf.Editor.AllowSVGScript {
+ svg = util.RemoveScriptsInSVG(svg)
+ }
+
c.Header("Content-Type", "image/svg+xml")
c.Header("Cache-Control", "no-cache")
c.Header("Pragma", "no-cache")