fix(agent): use picoclaw home dir for history file instead of /tmp
Security fix for issue #2234: - HistoryFile was hardcoded to os.TempDir() which is world-readable - Now uses internal.GetPicoclawHome() which respects $PICOCLAW_HOME - Creates the home directory if it doesn't exist with proper permissions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
380debb506
commit
ab2c6207a2
1 changed files with 6 additions and 1 deletions
|
|
@ -82,9 +82,14 @@ func agentCmd(message, sessionKey, model string, debug bool) error {
|
|||
func interactiveMode(agentLoop *agent.AgentLoop, sessionKey string) {
|
||||
prompt := fmt.Sprintf("%s You: ", internal.Logo)
|
||||
|
||||
historyFile := filepath.Join(internal.GetPicoclawHome(), ".picoclaw_history")
|
||||
if err := os.MkdirAll(internal.GetPicoclawHome(), 0700); err != nil {
|
||||
fmt.Printf("Error creating picoclaw home directory: %v\n", err)
|
||||
}
|
||||
|
||||
rl, err := readline.NewEx(&readline.Config{
|
||||
Prompt: prompt,
|
||||
HistoryFile: filepath.Join(os.TempDir(), ".picoclaw_history"),
|
||||
HistoryFile: historyFile,
|
||||
HistoryLimit: 100,
|
||||
InterruptPrompt: "^C",
|
||||
EOFPrompt: "exit",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue