T09 · Insecure Skill Coding Practices
- Location
scripts/minimax_media.py:17- Finding
Configurable API Endpoint Can Receive the API Key and User Content
- Content
View full analysis
dict: """使用 MiniMax image-01 生成圖片""" url = f"{BASE_URL}/v1/image_generation" headers = { 'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json' } payload = { 'model': 'image-01', 'prompt': prompt } resp = requests.post(url, headers=headers, json=payload, timeout=60) ``` The TTS operation forwards the same credential and user content: ```python def text_to_speech(text: str, voice_id: str = 'female-tianmei', speed: float = 1.0, output_path: str = None) -> dict: """使用 MiniMax speech-2.8-hd 生成語音""" url = f"{BASE_URL}/v1/t2a_v2" headers = { 'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json' } payload = { 'model': 'speech-2.8-hd', 'text': text, 'stream': False, 'output_format': 'hex', 'voice_setting': { 'voice_id': voice_id, 'speed': speed, 'vol': 1, 'pitch': 0 }, 'language_boost': 'auto' } resp = requests.post(url, headers=headers, json=payload, timeout=60) ``` ### Technical Analysis Sending the API key and input text to the official MiniMax service is necessary for the declared cloud-based text-to-speech function. The default endpoint, `https://api.minimax.io`, is consistent with the documentation. However, `MINIMAX_BASE_URL` can replace that endpoint with an arbitrary URL. The code performs no scheme validation, host ...[truncated 1893 chars]- Remediation
View remediation
