mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Merge pull request #151 from johnh4098/fix/shell-injection-spawn-via-env-v2
fix(process): escape single quotes in spawn_via_env bg_command
This commit is contained in:
commit
7f423508e4
1 changed files with 2 additions and 1 deletions
|
|
@ -247,8 +247,9 @@ class ProcessRegistry:
|
|||
# Run the command in the sandbox with output capture
|
||||
log_path = f"/tmp/hermes_bg_{session.id}.log"
|
||||
pid_path = f"/tmp/hermes_bg_{session.id}.pid"
|
||||
safe_command = command.replace("'", "'\''")
|
||||
bg_command = (
|
||||
f"nohup bash -c '{command}' > {log_path} 2>&1 & "
|
||||
f"nohup bash -c '{safe_command}' > {log_path} 2>&1 & "
|
||||
f"echo $! > {pid_path} && cat {pid_path}"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue