T09 · Insecure Skill Coding Practices
- Location
scripts/future_video_render.py:226- Finding
API Key Can Be Transmitted Over Plaintext HTTP to an Arbitrary Custom Host
- Content
View full analysis
Vulnerability Details
File Location:
scripts/future_video_render.py:226-233, with credential attachment atscripts/future_video_render.py:354-375
Vulnerability Type: Insufficient transport security for sensitive credentials
Risk Level: MediumVulnerable Code
python def validate_agent_origin(parsed: urllib.parse.ParseResult, *, allow_custom_host: bool) -> None: host = (parsed.hostname or "").lower() if parsed.scheme == "https" and host in ALLOWED_AGENT_HOSTS: return if allow_custom_host: return allowed = ", ".join(sorted(ALLOWED_AGENT_HOSTS)) raise RenderToolError( f"refusing to send an API key to {parsed.geturl()}; expected HTTPS host in {allowed}. " f"For trusted local or staging FVS backends, pass --allow-custom-host or set {CUSTOM_HOST_ENV}=1." )The accepted URL is subsequently used with the API key attached:
python def request_json_api( *, url: str, method: str, api_key: str, agent_base: str, body: bytes | None = None, content_type: str | None = None, ) -> dict: url = validate_api_request_url(url, agent_base=agent_base) headers = { "X-FVS-Agent-Key": api_key, "Accept": "application/json", } if content_type: headers["Content-Type"] = content_type request = urllib.request.Request(url=url, data=body, headers=headers, method=method) try: with urllib.request.urlopen(request, timeout=120) as response: raw = response.read()Technical Analysis
The default configuration appropriately restricts credential transmission to the HTTPS production host
app.future.video. However, setting--allow-custom-hostorFVS_ALLOW_CUSTOM_AGENT_HOST=1causesvalidate_agent_originto accept any absolute HTTP or HTTPS origin, including a non-loopback plaintext HTTP endpoint.request_json_apiuncon ...[truncated 2219 chars]- Remediation
View remediation
Remediation Suggestions
- Require HTTPS for every custom host except explicitly recognized loopback addresses.
- If local development requires plaintext HTTP, permit it only for validated loopback hosts such as
127.0.0.1,::1, orlocalhost; do not rely on a general custom-host bypass. - Separate the controls for hostname override and insecure transport. For example, use
--allow-custom-hostfor custom HTTPS hosts and a distinct, strongly warned--allow-insecure-loopback-httpoption for local testing. - Reject URLs containing user information and normalize ports and hostnames before origin comparison.
- Display the final credential destination and require explicit confirmation before sending a production API key to a non-production host.
- Recommend separate, least-privileged staging credentials and prevent production wallet-backed credentials from being used with insecure development endpoints.
- Add automated tests confirming that custom remote HTTP origins are rejected even when custom-host mode is enabled, while explicitly approved loopback development cases behave as intended.
