security: fix command injection in cline auth via remote env var expansion (#1473)

All 9 cline.sh scripts embedded OPENROUTER_API_KEY directly into the
cloud_run command string, allowing shell metacharacter injection on the
remote server. Fix by escaping the dollar sign (\${OPENROUTER_API_KEY})
so the variable is expanded on the remote machine where it's already
set via agent_env_vars()/generate_env_config, not locally before being
passed to cloud_run.

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:
A 2026-02-19 09:25:16 -08:00 committed by GitHub
parent e2d6aa1444
commit d8785c3d0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 9 additions and 9 deletions

View file

@ -20,7 +20,7 @@ agent_env_vars() {
}
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() { echo 'source ~/.zshrc && cline'; }

View file

@ -23,7 +23,7 @@ agent_env_vars() {
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() {

View file

@ -20,7 +20,7 @@ agent_env_vars() {
}
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() { echo 'source ~/.zshrc && cline'; }

View file

@ -23,7 +23,7 @@ agent_env_vars() {
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() {

View file

@ -20,7 +20,7 @@ agent_env_vars() {
}
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() { echo 'source ~/.zshrc && cline'; }

View file

@ -20,7 +20,7 @@ agent_env_vars() {
}
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() { echo 'source ~/.zshrc && cline'; }

View file

@ -23,7 +23,7 @@ agent_env_vars() {
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc 2>/dev/null; cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc 2>/dev/null; cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() {

View file

@ -20,7 +20,7 @@ agent_env_vars() {
}
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() { echo 'source ~/.zshrc && cline'; }

View file

@ -23,7 +23,7 @@ agent_env_vars() {
agent_configure() {
log_step "Authenticating Cline with OpenRouter..."
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"${OPENROUTER_API_KEY}\""
cloud_run "source ~/.zshrc && cline auth -p openrouter -k \"\${OPENROUTER_API_KEY}\""
}
agent_launch_cmd() {