T09 · Insecure Skill Coding Practices
- Location
scripts/gen.py:60- Finding
Configurable API Endpoint Can Expose the API Key and User Content
- Content
View full analysis
dict: """POST /images/generations""" url = f"{base_url.rstrip('/')}/images/generations" payload = { "model": model, "prompt": prompt, "n": count, "response_format": response_format, } if size: payload["size"] = size if aspect_ratio: payload["aspect_ratio"] = aspect_ratio body = json.dumps(payload).encode("utf-8") req = urllib.request.Request( url, method="POST", headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}, data=body, ) ``` ```python api_key = os.environ.get("VVMAI_API_KEY", "").strip() base_url = os.environ.get("VVMAI_BASE_URL", "https://api.vvmai.com/v1").strip() ``` The same endpoint construction and bearer-token transmission pattern is also used by `request_edit`, where an input image is included in the request. ### Technical Analysis The Skill legitimately needs to transmit an API key and prompt to the declared VVMAI image-generation service. However, `VVMAI_BASE_URL` is accepted without validating its scheme or destination host. Consequently, the bearer credential and request content can be sent to any configured host, including a plaintext HTTP endpoint. This exceeds the minimum network privilege needed for the default functionality. A Skill intended to access VVMAI only needs access to VVMAI's authenticated HTTPS endpoint. Supporting arbitrary endpoints without an explicit trust boundary allows a modified environment or configuration file to redirect sensitive requ ...[truncated 1370 chars]- Remediation
View remediation
