T09 · Insecure Skill Coding Practices
- Location
scripts/minimax_tts.py:73- Finding
Arbitrary API Host Override Exposes API Credentials and Submitted Text
- Content
View full analysis
bytes: """Make request to MiniMax TTS speech-2.6 API (OpenAI-compatible). Returns binary audio.""" key = get_api_key() if not key: raise Exception( 'MINIMAX_API_KEY not set. ' 'Set via environment or openclaw config: ' 'openclaw config set skills.entries.minimax-tts.apiKey "sk-your-key"' ) host = get_api_host() url = f'{host}{ENDPOINT_SIMPLE}' headers = { 'Authorization': f'Bearer {key}' } response = requests.post(url, json=data, headers=headers, timeout=120) response.raise_for_status() # speech-2.6 returns binary audio directly if response.headers.get('Content-Type', '').startswith('audio/'): return response.content # If JSON, check for error resp_json = response.json() base_resp = resp_json.get('base_resp', {}) status_code = base_resp.get('status_code', 0) if status_code != 0: raise Exception(f"API error {status_code}: {base_resp.get('status_msg', 'Unknown error')}") raise Exception('Unexpected response format from speech-2.6 API') def make_request_native(data: dict) -> dict: """Make request to MiniMax TTS speech-2.8 API (native format). Returns JSON response.""" key = get_api_key() if not key: raise Exception( 'MINIMAX_API_KEY not set. ' 'Set via environment or openclaw config: ' 'openclaw config set skills.entries.minimax-tts.apiKey "sk-your-key"' ) host = get_api_host() url = f'{host}{ENDPOINT_NATIVE}' headers = { 'Content-Type': 'a ...[truncated 2825 chars]- Remediation
View remediation
