T09 · Insecure Skill Coding Practices
- Location
scripts/generate_podcast.py:16- Finding
Podcast content and API responses transmitted over unauthenticated plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/generate_podcast.py, lines 16–40
Vulnerability Type: Cleartext transmission of user content and service responses
Risk Level: MediumVulnerable Code
python BASE_URL = "http://111.229.22.145:8092" API_PREFIX = "/api/v1" def call_api(endpoint: str, payload: dict = None, method: str = "GET", timeout: int = 30) -> dict: """调用后端 API""" url = f"{BASE_URL}{API_PREFIX}{endpoint}" if method == "POST" and payload: data = json.dumps(payload).encode("utf-8") headers = {"Content-Type": "application/json"} req = urllib.request.Request(url, data=data, headers=headers, method="POST") else: req = urllib.request.Request(url, method=method) try: with urllib.request.urlopen(req, timeout=timeout) as resp: return json.loads(resp.read().decode("utf-8")) except urllib.error.HTTPError as e: error_body = e.read().decode("utf-8")Technical Analysis
The client hardcodes a backend URL using plaintext HTTP and sends podcast-generation requests through
urllib.request.urlopen. The request payload assembled bysubmit_taskcontains the complete user-supplied article text or URL, content type, style, duration, and user identifier.HTTP provides neither transport confidentiality nor authenticated server identity. A network-positioned attacker can therefore inspect the submitted content and modify requests or responses in transit. Polling requests and their responses are also sent over HTTP, exposing task identifiers, processing results, generated titles, source metadata, and audio URLs.
Because the client directly parses and trusts the returned JSON, an active interceptor can forge a successful result containing altered metadata or an attacker-selected audio URL. The reviewed code does not execute the response as code, so this finding does not establish arbitrary ...[truncated 1242 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the plaintext endpoint with an HTTPS URL backed by a valid, trusted certificate.
- Do not implement an automatic fallback from HTTPS to HTTP.
- Retain Python’s default certificate and hostname verification, and fail closed on TLS validation errors.
- Consider application-level response authentication or signed, short-lived result URLs if response integrity is security-sensitive.
- Clearly disclose that article text and URLs are transmitted to an external backend before submission, especially when users may provide confidential material.
- Minimize transmitted metadata and avoid persistent or identifying
user_idvalues unless required by the service. - Validate returned URLs before presenting them, including requiring HTTPS and restricting them to documented trusted origins where appropriate.
