mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-22 19:54:22 +00:00
security: fix unsafe command substitution in GCP cloud-init script (#1413)
Replace nested command substitution $(echo "$(whoami)") with $USER environment variable to prevent potential command injection attacks. The nested substitution was vulnerable because: - whoami could be aliased or PATH-manipulated in compromised environments - Running as root in cloud-init amplified the security impact - Double nesting was unnecessary complexity Using $USER is safer because: - It's a shell variable, not command execution - No subprocess spawning or PATH resolution - Simpler and more reliable Agent: test-engineer 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
e52e290b25
commit
7187ef1cbf
1 changed files with 2 additions and 2 deletions
|
|
@ -139,9 +139,9 @@ get_cloud_init_userdata() {
|
|||
apt-get update -y
|
||||
apt-get install -y curl unzip git zsh
|
||||
# Install Bun
|
||||
su - $(logname 2>/dev/null || echo "$(whoami)") -c 'curl -fsSL https://bun.sh/install | bash' || true
|
||||
su - $(logname 2>/dev/null || echo "$USER") -c 'curl -fsSL https://bun.sh/install | bash' || true
|
||||
# Install Claude Code
|
||||
su - $(logname 2>/dev/null || echo "$(whoami)") -c 'curl -fsSL https://claude.ai/install.sh | bash' || true
|
||||
su - $(logname 2>/dev/null || echo "$USER") -c 'curl -fsSL https://claude.ai/install.sh | bash' || true
|
||||
# Configure PATH for all users
|
||||
echo 'export PATH="${HOME}/.claude/local/bin:${HOME}/.bun/bin:${PATH}"' >> /etc/profile.d/spawn.sh
|
||||
chmod +x /etc/profile.d/spawn.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue