mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-19 16:39:50 +00:00
Add whitelist validation for AGENT_NAME immediately after the empty check to prevent command injection and path traversal via the parameter. While the existing case statement catches unknown agents, explicit upfront validation makes the security intent clear and defensive. Agent: security-auditor Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bf28ccde87
commit
70d8462e56
1 changed files with 9 additions and 0 deletions
|
|
@ -11,6 +11,15 @@ if [ -z "${AGENT_NAME}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Validate agent name against allowed list to prevent injection
|
||||
case "${AGENT_NAME}" in
|
||||
openclaw|codex|kilocode|claude|opencode|zeroclaw|hermes) ;;
|
||||
*)
|
||||
printf 'Error: Invalid agent name: %s\nAllowed: openclaw, codex, kilocode, claude, opencode, zeroclaw, hermes\n' "${AGENT_NAME}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
PATHS_FILE="/tmp/spawn-tarball-paths.txt"
|
||||
: > "${PATHS_FILE}"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue