收紧运行目录与管理员本地文件读取边界

This commit is contained in:
xuans committed 2026-09-22 03:26:01 +08:00
1 parent f732a255ce
commit 2dd5156018
5 files changed
+98 -6

No files matched your search

+9 -1
View File
@@ -16,7 +16,15 @@ func MigrateLegacySSLStorage(root string) error {
if !runtimepath.DeploymentLayout(root) {
return nil
}
data, err := os.ReadFile(filepath.Join(root, "config", "config.json"))
configRoot, err := os.OpenRoot(filepath.Join(root, "config"))
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}
data, err := configRoot.ReadFile("config.json")
_ = configRoot.Close()
if os.IsNotExist(err) {
return nil
}