T09 · Insecure Skill Coding Practices
- Location
scripts/image.sh:150- Finding
Google API Key Exposed in Process Command-Line Arguments
- Content
View full analysis
/dev/null) ``` ### Technical Analysis The Google API key is interpolated directly into the request URL. As a result, the key becomes part of the `curl` process's command-line arguments. Depending on the operating system and local security configuration, command-line arguments may be exposed through process inspection interfaces, process-monitoring agents, diagnostic tooling, audit logs, crash reports, or debugging output. URLs are also more likely than authentication headers to be retained by proxy and observability systems. Although HTTPS protects the URL while it is transmitted to Google, it does not prevent local command-line disclosure or accidental logging of the complete authenticated URL. ### Attack Path 1. A user invokes image generation with `GOOGLE_API_KEY` configured. 2. The Skill starts `curl` with the API key embedded in its URL. 3. While the process is active, another local user or monitoring process reads its command-line arguments. 4. Alternatively, a diagnostic or observability system records the complete URL. 5. The recovered key is used outside the Skill to consume the victim's quota or invoke other services permitted by the key's configuration. ### Impact Assessment An attacker able to observe local process arguments or relevant logs could obtain the Google API key. The resulting access is limited to the services and restrictions configured for that key, but may include: - Unauthorized API requests - Consumption of paid quota - Exhaustion of rate limits - Access to other Google APIs enabled for an insufficiently restricted key - Di ...[truncated 125 chars]- Remediation
View remediation
/dev/null) ``` 2. Restrict the Google API key to only the required API and models. 3. Apply quota and billing alerts to detect unauthorized use. 4. Ensure authenticated URLs and headers are redacted from debugging and monitoring output. 5. Rotate any key that may already have been exposed through process or request logging. ]]>
