T09 · Insecure Skill Coding Practices
- Location
video-generation-provider.ts:127- Finding
Server-Side Request Forgery Through an Unvalidated Generated-Video URL
- Content
View full analysis
{ const response = await fetchWithTimeout( params.url, { method: "GET" }, params.timeoutMs ?? DEFAULT_TIMEOUT_MS, params.fetchFn, ); await assertOkOrThrowHttpError(response, "Vidu generated video download failed"); const mimeType = normalizeOptionalString(response.headers.get("content-type")) ?? "video/mp4"; const arrayBuffer = await response.arrayBuffer(); return { buffer: Buffer.from(arrayBuffer), mimeType, fileName: `video-1.${mimeType.includes("webm") ? "webm" : "mp4"}`, }; } ``` The remotely supplied URL reaches this function here: ```ts const videoUrl = normalizeOptionalString(completed.creations?.[0]?.url); if (!videoUrl) { throw new Error("Vidu video generation completed without a video URL"); } const video = await downloadViduVideo({ url: videoUrl, timeoutMs: req.timeoutMs, fetchFn, }); ``` ### Technical Analysis The generated-video URL comes from `completed.creations[0].url`, which is controlled by the remote API response. The plugin passes this URL directly to `fetchWithTimeout` without validating its protocol, hostname, resolved IP address, port, or redirect chain. Creation requests use `resolveProviderHttpRequestConfig` and explicitly set `allowPrivateNetwork: false`. The generated-video download does not apply the same dispatcher policy or private-network restriction. Consequently, the protection covering the initial Vidu API request is not visibly applied to this secondary request. If the API response can be manipulated—for example, through compromise of the provider, a malicious configured endpoint, or another u ...[truncated 1870 chars]- Remediation
View remediation
