T09 · Insecure Skill Coding Practices
- Location
scripts/tts/generate_voice.sh:69- Finding
Unrestricted API Host Allows Disclosure of Bearer Credentials and User Media
- Content
View full analysis
/dev/null)" || { echo "Error: curl request failed" >&2 exit 1 } ``` Voice-cloning uploads also send the bearer credential and the selected local file to the configured host: ```bash api_upload() { # api_upload ENDPOINT FILE_PATH PURPOSE local endpoint="$1" file_path="$2" purpose="$3" local url="${API_BASE}/${endpoint#/}" local output http_code response output="$(curl -s -w "\n%{http_code}" \ -X POST \ -H "Authorization: Bearer ${MINIMAX_API_KEY}" \ -H "Accept-Encoding: gzip, deflate" \ --compressed \ -F "file=@${file_path}" \ -F "purpose=${purpose}" \ --max-time 120 \ "$url" 2>/dev/null)" || { echo "Error: cur ...[truncated 4815 chars]- Remediation
View remediation
&2 return 1 ;; esac } ``` 3. **Call host validation immediately before every authenticated request.** Do not rely solely on a separate environment-checking command, because users may invoke generation scripts directly. 4. **Restrict protocols and redirect behavior in `curl`.** Use controls such as: ```bash curl \ --proto '=https' \ --proto-redir '=https' \ --max-redirs 0 \ ... ``` If redirects are required by a documented API operation, validate the redirect destination before forwarding credentials. Do not use credential-forwarding options such as `--location-trusted`. 5. **Reject malformed or expanded origins.** Do not accept unexpected ports, URL user information, query strings, fragments, alternate host spellings, or subdomains. Compare a normalized origin rather than using substring or suffix matching. 6. **Reduce trust in workspace configuration.** Do not automatically use a current-working-directory `.env` to determine credential destinations. Prefer explicit process configuration or a trusted, permission-restricted configuration file. If `.env` support is retained, ignore destination overrides unless they pass the exact allowlist. 7. **Separate credentialed API requests from media downloads.** ...[truncated 747 chars]
