From 8843ed076d858a7d8b1678511538d2aba40b3fca Mon Sep 17 00:00:00 2001 From: merlinmiao <820962493@qq.com> Date: Sun, 5 Apr 2026 10:42:12 +0800 Subject: [PATCH] fix(cli): use picoclaw home dir for history file instead of temp dir Security fix for issue #2234: - HistoryFile was hardcoded to os.TempDir() (/tmp on Linux) - /tmp is typically world-readable (mode 1777) exposing command history - An attacker could create symlinks to overwrite sensitive files - Now uses internal.GetPicoclawHome() which respects $PICOCLAW_HOME environment variable and falls back to ~/.picoclaw --- cmd/picoclaw/internal/agent/helpers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/picoclaw/internal/agent/helpers.go b/cmd/picoclaw/internal/agent/helpers.go index 23227d56a..f8b2cb0a8 100644 --- a/cmd/picoclaw/internal/agent/helpers.go +++ b/cmd/picoclaw/internal/agent/helpers.go @@ -84,7 +84,7 @@ func interactiveMode(agentLoop *agent.AgentLoop, sessionKey string) { rl, err := readline.NewEx(&readline.Config{ Prompt: prompt, - HistoryFile: filepath.Join(os.TempDir(), ".picoclaw_history"), + HistoryFile: filepath.Join(internal.GetPicoclawHome(), ".picoclaw_history"), HistoryLimit: 100, InterruptPrompt: "^C", EOFPrompt: "exit",