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-fq2j-j8hc-8vw8

Daniel294b8b429dea
diff --git a/kernel/api/lute.go b/kernel/api/lute.go
index a39119512d..7db179ed6e 100644
--- a/kernel/api/lute.go
+++ b/kernel/api/lute.go
@@ -176,6 +176,11 @@ func html2BlockDOM(c *gin.Context) {
return ast.WalkContinue
}
+ if util.IsSensitivePath(localPath) {
+ logging.LogWarnf("skip copying asset [%s] due to sensitive path", localPath)
+ return ast.WalkContinue
+ }
+
name := filepath.Base(localPath)
ext := filepath.Ext(name)
name = name[0 : len(name)-len(ext)]
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 4e64caa008..00ffbb3f3f 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -171,7 +171,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/tag/removeTag", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, removeTag)
ginServer.Handle("POST", "/api/lute/spinBlockDOM", model.CheckAuth, spinBlockDOM) // 未测试
- ginServer.Handle("POST", "/api/lute/html2BlockDOM", model.CheckAuth, html2BlockDOM)
+ ginServer.Handle("POST", "/api/lute/html2BlockDOM", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, html2BlockDOM)
ginServer.Handle("POST", "/api/lute/copyStdMarkdown", model.CheckAuth, copyStdMarkdown)
ginServer.Handle("POST", "/api/query/sql", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, SQL)
diff --git a/kernel/util/path.go b/kernel/util/path.go
index 0dee81ee37..a050d13c28 100644
--- a/kernel/util/path.go
+++ b/kernel/util/path.go
@@ -361,7 +361,6 @@ func IsSensitivePath(p string) bool {
"/.",
"/etc",
"/root",
- "/etc",
"/var",
"/proc",
"/sys",