mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-06-01 06:09:53 +00:00
Add validate_model_id function to digitalocean/lib/common.sh
This commit is contained in:
parent
0d31aba9f0
commit
bb4c41be3e
1 changed files with 12 additions and 0 deletions
|
|
@ -66,6 +66,18 @@ open_browser() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Validate model ID to prevent command injection
|
||||||
|
validate_model_id() {
|
||||||
|
local model_id="$1"
|
||||||
|
if [[ -z "$model_id" ]]; then return 0; fi
|
||||||
|
if [[ ! "$model_id" =~ ^[a-zA-Z0-9/_:.-]+$ ]]; then
|
||||||
|
log_error "Invalid model ID: contains unsafe characters"
|
||||||
|
log_error "Model IDs should only contain: letters, numbers, /, -, _, :, ."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# Manually prompt for API key
|
# Manually prompt for API key
|
||||||
get_openrouter_api_key_manual() {
|
get_openrouter_api_key_manual() {
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue