Skip to content

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

:lock: Disable HTTP access to the /assets/ path https://github.com/siyuan-note/siyuan/issues/15257

Daniel31f5797176af
diff --git a/kernel/server/serve.go b/kernel/server/serve.go
index a1eb075807..7ebb1e1a63 100644
--- a/kernel/server/serve.go
+++ b/kernel/server/serve.go
@@ -475,6 +475,12 @@ func serveAssets(ginServer *gin.Engine) {
ginServer.GET("/assets/*path", model.CheckAuth, func(context *gin.Context) {
requestPath := context.Param("path")
+ if "/" == requestPath || "" == requestPath {
+ // 禁止访问根目录 Disable HTTP access to the /assets/ path https://github.com/siyuan-note/siyuan/issues/15257
+ context.Status(http.StatusForbidden)
+ return
+ }
+
relativePath := path.Join("assets", requestPath)
p, err := model.GetAssetAbsPath(relativePath)
if err != nil {