mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-05 23:50:48 +00:00
fix: Escape API keys in continue.sh JSON configs to prevent injection (#374)
Replace vulnerable heredoc patterns across 27 continue.sh scripts with setup_continue_config() helper that uses json_escape() + upload_config_file() to safely handle API keys containing special characters like quotes or braces. Also fix _save_token_to_config() in shared/common.sh which had the same unescaped heredoc vulnerability for local token storage. Relates to #104 Agent: security-auditor Co-authored-by: A <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9fd35a77b7
commit
81bab47a74
28 changed files with 104 additions and 413 deletions
|
|
@ -38,21 +38,9 @@ log_warn "Setting up environment variables..."
|
|||
inject_env_vars_ssh "${DO_SERVER_IP}" upload_file run_server \
|
||||
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
||||
|
||||
log_warn "Creating Continue config file..."
|
||||
run_server "${DO_SERVER_IP}" "mkdir -p ~/.continue"
|
||||
run_server "${DO_SERVER_IP}" "cat > ~/.continue/config.json << 'EOF'
|
||||
{
|
||||
\"models\": [
|
||||
{
|
||||
\"title\": \"OpenRouter\",
|
||||
\"provider\": \"openrouter\",
|
||||
\"model\": \"openrouter/auto\",
|
||||
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
||||
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF"
|
||||
setup_continue_config "${OPENROUTER_API_KEY}" \
|
||||
"upload_file ${DO_SERVER_IP}" \
|
||||
"run_server ${DO_SERVER_IP}"
|
||||
|
||||
echo ""
|
||||
log_info "DigitalOcean droplet setup completed successfully!"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue