Skip to content

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

:lock: https://github.com/siyuan-note/siyuan/security/advisories/GHSA-vw86-c94w-v3x4

Daniel46ce40155200
diff --git a/kernel/api/av.go b/kernel/api/av.go
index 651145cdb9..09dc792cae 100644
--- a/kernel/api/av.go
+++ b/kernel/api/av.go
@@ -39,6 +39,9 @@ func removeUnusedAttributeView(c *gin.Context) {
}
avID := arg["id"].(string)
+ if util.InvalidIDPattern(avID, ret) {
+ return
+ }
model.RemoveUnusedAttributeView(avID)
ret.Data = map[string]any{
"id": avID,
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 14056a6cfe..7eb74c87ec 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -47,10 +47,14 @@ import (
)
func RemoveUnusedAttributeView(id string) {
- absPath := filepath.Join(util.DataDir, "storage", "av", id+".json")
+ base := filepath.Join(util.DataDir, "storage", "av")
+ absPath := filepath.Join(base, id+".json")
if !filelock.IsExist(absPath) {
return
}
+ if !gulu.File.IsSubPath(base, absPath) {
+ return
+ }
historyDir, err := GetHistoryDir(HistoryOpClean)
if err != nil {