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

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-18 10:15:48 +08:00
parent dbeb703ad1
commit 5c0cc375b4
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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")