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-grjj-6f6g-cq8q
Danielb5e9c9e83ea3
diff --git a/kernel/api/notification.go b/kernel/api/notification.goindex e9576abc13..20f960d390 100644--- a/kernel/api/notification.go+++ b/kernel/api/notification.go@@ -42,6 +42,8 @@ func pushMsg(c *gin.Context) {if nil != arg["timeout"] {timeout = int(arg["timeout"].(float64))}++ msg = util.SanitizeHTML(msg)msgId := util.PushMsg(msg, timeout)ret.Data = map[string]any{@@ -67,6 +69,8 @@ func pushErrMsg(c *gin.Context) {if nil != arg["timeout"] {timeout = int(arg["timeout"].(float64))}++ msg = util.SanitizeHTML(msg)msgId := util.PushErrMsg(msg, timeout)ret.Data = map[string]any{diff --git a/kernel/go.mod b/kernel/go.modindex c37bb4027d..c673b69339 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -49,6 +49,7 @@ require (github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51github.com/klippa-app/go-pdfium v1.17.2github.com/mattn/go-sqlite3 v2.0.3+incompatible+ github.com/microcosm-cc/bluemonday v1.0.27github.com/mitchellh/go-ps v1.0.0github.com/mssola/useragent v1.0.0github.com/olahol/melody v1.4.0@@ -119,6 +120,7 @@ require (github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 // indirectgithub.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirectgithub.com/aws/smithy-go v1.24.3 // indirect+ github.com/aymerick/douceur v0.2.0 // indirectgithub.com/bytedance/gopkg v0.1.3 // indirectgithub.com/bytedance/sonic v1.14.1 // indirectgithub.com/bytedance/sonic/loader v0.3.0 // indirectdiff --git a/kernel/go.sum b/kernel/go.sumindex e28706a3df..98278a7eb4 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -93,6 +93,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 h1:p8ogvvLugcR/zLBXTXrTkj0RYBUgithub.com/aws/aws-sdk-go-v2/service/sts v1.41.10/go.mod h1:60dv0eZJfeVXfbT1tFJinbHrDfSJ2GZl4Q//OSSNAVw=github.com/aws/smithy-go v1.24.3 h1:XgOAaUgx+HhVBoP4v8n6HCQoTRDhoMghKqw4LNHsDNg=github.com/aws/smithy-go v1.24.3/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=+github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=+github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=github.com/bytedance/sonic v1.14.1 h1:FBMC0zVz5XUmE4z9wF4Jey0An5FueFvOsTKKKtwIl7w=@@ -285,6 +287,8 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+mgithub.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=+github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=+github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=diff --git a/kernel/util/misc.go b/kernel/util/misc.goindex c4996f9390..8ef925abfc 100644--- a/kernel/util/misc.go+++ b/kernel/util/misc.go@@ -26,6 +26,7 @@ import ("unicode""github.com/88250/lute/html"+ "github.com/microcosm-cc/bluemonday""github.com/siyuan-note/logging")@@ -211,6 +212,11 @@ func GetContainsSubStrs(s string, subStrs []string) (ret []string) {return}+func SanitizeHTML(h string) string {+ p := bluemonday.UGCPolicy()+ return p.Sanitize(h)+}+func SanitizeSVG(svgInput string) string {// 1. 将字符串解析为节点树doc, err := html.Parse(strings.NewReader(svgInput))