Skip to content

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

:lock: Prevent ControlConcurrency map growth from unknown request paths https://github.com/siyuan-note/siyuan/security/advisories/GHSA-p59v-3q54-qq55

Danielce2c79493d3b
diff --git a/kernel/model/session.go b/kernel/model/session.go
index ac63d1f313..bbc97fe724 100644
--- a/kernel/model/session.go
+++ b/kernel/model/session.go
@@ -548,6 +548,15 @@ func ControlConcurrency(c *gin.Context) {
return
}
+ // 仅对已注册的静态 /api/ 路径做并发控制:路由表有限,requesting map 不会无界增长;
+ // 未知路径与带参数通配路由直接放行 https://github.com/siyuan-note/siyuan/security/advisories/GHSA-p59v-3q54-qq55
+ if !strings.HasPrefix(reqPath, "/api/") ||
+ "" == c.FullPath() ||
+ strings.ContainsAny(c.FullPath(), ":*") {
+ c.Next()
+ return
+ }
+
requestingLock.Lock()
mutex := requesting[reqPath]
if nil == mutex {