fix: harden codex home boundaries

This commit is contained in:
Yoilun
2026-05-25 16:21:25 +08:00
parent be466ae5fc
commit dc8b06f961
6 changed files with 190 additions and 1 deletions

View File

@@ -11,6 +11,12 @@ type Config struct {
}
func DefaultConfig() Config {
if codexHome := os.Getenv("CODEX_HOME"); codexHome != "" {
return Config{
CodexHome: codexHome,
HTTPAddr: "127.0.0.1:18083",
}
}
home, err := os.UserHomeDir()
if err != nil {
home = "."