Skip to content

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

:lock: XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034

Daniel9718d3b1c827
diff --git a/kernel/model/blockial.go b/kernel/model/blockial.go
index 2d64f1bd39..24c6fb9f60 100644
--- a/kernel/model/blockial.go
+++ b/kernel/model/blockial.go
@@ -250,6 +250,21 @@ func setNodeAttrs0(node *ast.Node, nameValues map[string]string) (oldAttrs map[s
func pushBroadcastAttrTransactions(oldAttrs map[string]string, node *ast.Node) {
newAttrs := parse.IAL2Map(node.KramdownIAL)
+
+ // XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034
+ for name, value := range oldAttrs {
+ if "icon" == name {
+ value = util.FilterUploadEmojiFileName(value)
+ oldAttrs[name] = value
+ }
+ }
+ for name, value := range newAttrs {
+ if "icon" == name {
+ value = util.FilterUploadEmojiFileName(value)
+ newAttrs[name] = value
+ }
+ }
+
data := map[string]interface{}{"old": oldAttrs, "new": newAttrs}
if "" != node.AttributeViewType {
data["data-av-type"] = node.AttributeViewType