T09 · Insecure Skill Coding Practices
- Location
scripts/gemini_video_url_analyzer.py:32- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/gemini_video_url_analyzer.py, lines 32–35
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: Mediumpython parser.add_argument( "--api-key", help="Gemini API key. If omitted, GEMINI_API_KEY or GOOGLE_API_KEY is used.", )Technical Analysis
The script permits a Gemini API key to be supplied through the
--api-keycommand-line option. Command-line arguments are not a secure secret-transfer mechanism: they may be stored in shell history, captured by process-monitoring or audit tools, included in diagnostic logs, and exposed through process inspection to other sufficiently privileged local users.Although environment-variable alternatives are supported, the insecure command-line option remains available and is explicitly documented in the help text.
Attack Path
- A user runs the analyzer with
--api-key <secret>. - The key becomes part of the process command line and may also be retained in shell history or execution logs.
- A local user, monitoring service, support bundle, or log reader obtains the exposed argument.
- The observer reuses the key to make unauthorized Gemini API requests.
Exploitation requires access to command history, process metadata, or logs containing the invocation.
Impact Assessment
Disclosure grants the attacker the API permissions associated with the compromised Gemini key. The attacker may consume the account's API quota, incur charges, access enabled Gemini services, and cause service disruption through quota exhaustion. This issue does not directly grant operating-system privileges beyond those already needed to inspect the relevant process data or logs.
- A user runs the analyzer with
- Remediation
View remediation
Remediation Suggestions
- Remove the
--api-keycommand-line option and accept credentials only through a protected secret manager or environment variable. - For interactive use, obtain the key with
getpass.getpass()so it is not echoed or added to shell history. - If command-line support must remain for compatibility, emit a prominent warning and mark the option as deprecated.
- Ensure application logs, telemetry, process snapshots, and support bundles redact API keys.
- Document key rotation and revocation procedures for credentials that may already have been exposed.
- Scope API keys to the minimum required APIs, projects, quotas, and network restrictions supported by the provider.
- Remove the
