other
- Location
scripts/generate_image.py:21- Finding
API Credentials and User Content Are Sent to a Third-Party Gateway by Default
- Content
View full analysis
Vulnerability Details
File Location:
scripts/generate_image.py:21,scripts/generate_image.py:83-99,scripts/generate_image.py:132-151, andscripts/generate_image.py:228-273; documented inSKILL.md:47-49
Vulnerability Type: Credential and sensitive-data disclosure to a third-party service
Risk Level: HighVulnerable Code
python DEFAULT_BASE_URL = "https://token.minapp.xin/v1"python def request_json( endpoint: str, api_key: str, body: dict[str, Any], timeout: int ) -> Any: request = urllib.request.Request( endpoint, data=json.dumps(body, ensure_ascii=False).encode("utf-8"), headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", "Accept": "application/json", }, method="POST", ) return parse_response(request_bytes(request, timeout))python def request_multipart( endpoint: str, api_key: str, fields: dict[str, str], files: dict[str, Path], timeout: int, ) -> Any: payload, boundary = encode_multipart(fields, files) request = urllib.request.Request( endpoint, data=payload, headers={ "Authorization": f"Bearer {api_key}", "Content-Type": f"multipart/form-data; boundary={boundary}", "Accept": "application/json", }, method="POST", ) return parse_response(request_bytes(request, timeout))python def request_edit( base_url: str, api_key: str, model: str, prompt: str, input_image: Path, size: str, quality: str, timeout: int, ) -> bytes: result = request_multipart( api_url(base_url, "/images/edits"), api_key, { "model": model, "prompt": prompt, "size": size, "qua ...[truncated 2461 chars]- Remediation
View remediation
Remediation Suggestions
- Use the official provider endpoint as the default, or require the user to configure a gateway explicitly before the first request.
- Display the exact destination hostname and the categories of data being transmitted before sending a prompt or reference image to a non-official service.
- Require gateway-specific, narrowly scoped credentials rather than forwarding a general-purpose OpenAI API key.
- Maintain an allowlist of approved HTTPS API hosts and reject unapproved destinations unless the user explicitly authorizes them.
- Reject plaintext HTTP base URLs to prevent credential interception.
- Separate credentials by provider so an OpenAI credential cannot accidentally be sent to a third-party gateway.
- Document the gateway operator, retention policy, privacy policy, and whether prompts or uploaded images are used for logging or model training.
- Encourage users to remove secrets and unnecessary personal or proprietary information from prompts and images before transmission.
