T09 · Insecure Skill Coding Practices
- Location
scripts/video_gen.js:20- Finding
API credentials can be redirected to an attacker-controlled endpoint
- Content
View full analysis
controller.abort(), 30_000); try { const res = await fetch(fullUrl, { method, headers, body: body != null ? JSON.stringify(body) : undefined, signal: controller.signal, }); ``` ```js async function apiRequest(method, path, body, apiKey) { return httpJson(method, BASE_URL + path, body, apiKey); } async function fetchModelsRegistry(apiKey) { return httpJson('GET', MODELS_BASE_URL + MODELS_API_PATH, null, apiKey); } ``` ### Technical Analysis The script obtains its generation and model-registry origins directly from the `WERYAI_BASE_URL` and `WERYAI_MODELS_BASE_URL` environment variables. It does not verify that the resulting URLs: - Use HTTPS. - Resolve to an approved WeryAI hostname. - Have the expected origin. - Are otherwise trusted to receive the WeryAI credential. The shared `httpJson` function unconditionally places `WERYAI_API_KEY` in the `Authorization` header for requests to either configured origin. Consequently, an actor capable of influencing the process environment can redirect authenticated requests to an arbitrary HTTP or HTTPS server. Sending the API key to the official WeryAI API is necessary for the declared video-generation functionality. Allowing the credential to be sent to unrestricte ...[truncated 1911 chars]- Remediation
View remediation
