package config import ( "os" "path/filepath" "testing" ) // TestConfigFileCreatedNotWorldReadable 覆盖 SECURITY_TODO #11: // 配置文件(内嵌会话密钥)不得被组/其他用户读取。 func TestConfigFileCreatedNotWorldReadable(t *testing.T) { path := filepath.Join(t.TempDir(), "config.yaml") LoadConfig(path) st, err := os.Stat(path) if err != nil { t.Fatalf("config file not created: %v", err) } if perm := st.Mode().Perm(); perm != 0640 { t.Fatalf("config perms = %v, want 0640", perm) } }