T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:108- Finding
Configurable API Endpoint Can Exfiltrate the API Key and User Text
- Content
View full analysis
bool: return bool(self.api_key) @property def headers(self) -> Dict[str, str]: if not self.api_key: raise APIError(_missing_key_message()) return { "Authorization": f"Bearer {self.api_key}", "Content-Type": "application/json", } def _post(self, payload: Dict[str, Any], stream: bool = False, timeout: int = 120) -> requests.Response: try: response = requests.post( self.api_url, headers=self.headers, json=payload, stream=stream, timeout=timeout, ) ``` ### Technical Analysis The script accepts `SENSEAUDIO_API_BASE` without validating its scheme or hostname. It then constructs the request URL from that value and sends an `Authorization: Bearer` header containing `SENSEAUDIO_API_KEY`. For synthesis operations, the JSON request body also includes the complete user-provided text and synthesis parameters. Consequently, a modified environment or untrusted runtime configuration can redirect authentication and synthesis requests to an attacker-controlled endpoint. Sending the API key and user text to the default official SenseAudio endpoint is necessary for the declared remote TTS functionality. Allowing those values to be sent to an arbitrary endpoint is not necessary and vio ...[truncated 1188 chars]- Remediation
View remediation
