T09 · Insecure Skill Coding Practices
- Location
generate.ts:77- Finding
Unvalidated API-Provided Export URL Enables Server-Side Request Forgery
- Content
View full analysis
{ // Gamma export endpoint const exportUrl = `${gammaUrl}/export/${format}` console.log(`Downloading ${format} from: ${exportUrl}`) const res = await fetch(exportUrl, { redirect: 'follow' }) if (!res.ok) { // Try alternate download approach — Gamma web export console.log(`Direct export failed (${res.status}), trying web export...`) // For now, return the gammaUrl for manual download return gammaUrl } const buffer = await res.arrayBuffer() await Bun.write(outputPath, buffer) return outputPath } ``` ### Technical Analysis The generation-status response is treated as trusted, and `data.gammaUrl` or `data.url` is passed directly into `downloadPresentation`. The code appends an export path and performs a network request without validating the URL's protocol, hostname, resolved address, or port. The request also uses `redirect: 'follow'`. Even if the initial URL points to an expected Gamma domain, an HTTP redirect can send the request to another host. A compromised Gamma service, malicious upstream response, DNS compromise, or other manipulation of the API response could cause the Agent to request arbitrary resources reachable from its execution environment. Potential targets include: - Services bound to `localhost` - Private-network HTTP services - Cloud instance metadata endpoints - Administrative interfaces that trust requests from the local network - Other endpoints inaccessible to an external attacker The downloaded response is written to the caller-selected out ...[truncated 1424 chars]- Remediation
View remediation
