T09 · Insecure Skill Coding Practices
- Location
scripts/livestream.py:25- Finding
Unrestricted API Endpoint Can Expose Device and Application Credentials
- Content
View full analysis
Dict[str, str]: """Generate request headers containing a signature and timestamp.""" time_millis = get_time_millis() signature = generate_signature(uuid, app_key, app_secret, time_millis, move_card) return { "Content-Type": "application/json; charset=UTF-8", "uuid": uuid, "appKey": app_key, "timeMillis": time_millis, "signature": signature, "X-Request-Id": os.urandom(16).hex() } def get_livestream_url(device_token: str, uuid: str, app_key: str, app_secret: str, move_card: int, channel: str = "0", stream: str = "1", protocol: str = "flv", username: str = "admin", password: str = "", expire_time: Optional[int] = None) -> Dict[str, Any]: """ Obtain a device livestream address. API: POST /gwp/v3/rtc/device/livestream/{deviceToken} """ url = f"{JF_BASE_URL}/rtc/device/livestream/{device_token}" headers = get_headers(uuid, app_key, app_secret, move_card) body = { "channel": channel, "stream": stream, "protocol": protocol, "username": username, "password": password } if expire_time: body["expireTime"] = str(expire_time) response = requests.post(url, headers=headers, json=body, timeout=30) ``` ### Technical Analysis The `JF_ENDPOINT` environment variable is inserted directly into the API URL without validation or an allowlist. The result ...[truncated 2282 chars]- Remediation
View remediation
