T09 · Insecure Skill Coding Practices
- Location
scripts/api_key.py:95- Finding
Bearer Token Sent to an Unvalidated Environment-Controlled Endpoint
- Content
View full analysis
str: base = (base or "").strip() if not base: return "" parsed = urlparse(base) path = parsed.path or "/" if not path.endswith("/"): path = f"{path}/" query = dict(parse_qsl(parsed.query)) query["Action"] = action query["Version"] = version return urlunparse(parsed._replace(path=path, query=urlencode(query))) ``` ### Technical Analysis When `MODEL_SPEECH_API_KEY` is unavailable, the Skill obtains `ARK_SKILL_API_KEY` and `ARK_SKILL_API_BASE` from environment variables. It then attaches the Ark key as an `Authorization: Bearer` header to requests targeting the supplied base URL. The code accepts any URL scheme, hostname, port, and path. It neither requires HTTPS nor restricts the hostname to an approved credential-management service. Consequently, an attacker who can influence the process environment or deployment configur ...[truncated 1864 chars]- Remediation
View remediation
