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: Hide sensitive paths from configuration responses https://github.com/siyuan-note/siyuan/security/advisories/GHSA-h4v5-crx2-3cv4
Daniel2d8b98395a91
diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex 2fa751f6d5..1c14c9132d 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -1253,6 +1253,9 @@ func HideConfSecret(c *AppConf) {c.MCPOAuth = ""c.CookieKey = ""c.Api = &conf.API{}+ if nil != c.Export {+ c.Export.PandocBin = ""+ }c.Flashcard = &conf.Flashcard{}c.ServerAddrs = []string{}c.Publish = &conf.Publish{}@@ -1270,6 +1273,7 @@ func HideConfSecret(c *AppConf) {c.System.ConfDir = ""c.System.DataDir = ""c.System.HomeDir = ""+ c.System.WorkspaceDir = ""c.System.Name = ""c.System.NetworkProxy = &conf.NetworkProxy{}}diff --git a/kernel/model/conf_secret_test.go b/kernel/model/conf_secret_test.goindex 117b600544..2118c4903a 100644--- a/kernel/model/conf_secret_test.go+++ b/kernel/model/conf_secret_test.go@@ -89,6 +89,41 @@ func TestHideConfSecretPreservesNotebookCryptoSettings(t *testing.T) {}}+func TestHideConfSecretHidesAbsolutePaths(t *testing.T) {+ appConf := NewAppConf()+ appConf.Export = &conf.Export{+ AddTitle: true,+ PandocBin: `C:\Users\alice\SiYuan\temp\pandoc\bin\pandoc.exe`,+ }+ appConf.System = &conf.System{+ KernelVersion: "3.3.0",+ HomeDir: `C:\Users\alice`,+ WorkspaceDir: `C:\Users\alice\SiYuan`,+ AppDir: `C:\Program Files\SiYuan`,+ ConfDir: `C:\Users\alice\SiYuan\conf`,+ DataDir: `C:\Users\alice\SiYuan\data`,+ }++ HideConfSecret(appConf)++ if "" != appConf.Export.PandocBin {+ t.Fatalf("pandoc path was not hidden: %q", appConf.Export.PandocBin)+ }+ if !appConf.Export.AddTitle {+ t.Fatal("functional export settings should be preserved")+ }+ if "" != appConf.System.HomeDir ||+ "" != appConf.System.WorkspaceDir ||+ "" != appConf.System.AppDir ||+ "" != appConf.System.ConfDir ||+ "" != appConf.System.DataDir {+ t.Fatalf("system paths were not hidden: %#v", appConf.System)+ }+ if "3.3.0" != appConf.System.KernelVersion {+ t.Fatalf("functional system settings were changed: %#v", appConf.System)+ }+}+func TestHideBoxConfSecretPreservesNotebookSettings(t *testing.T) {boxConf := &conf.BoxConf{Name: "Encrypted notebook",