T09 · Insecure Skill Coding Practices
- Location
scripts/transcribe_voice_notes.py:77- Finding
OpenAI API Key Exposed Through Process Arguments
- Content
View full analysis
str: """Transcribe audio via OpenAI Whisper API (curl).""" cmd = [ "curl", "-sS", "https://api.openai.com/v1/audio/transcriptions", "-H", f"Authorization: Bearer {OPENAI_API_KEY}", "-F", f"file=@{audio_path}", "-F", "model=whisper-1", "-F", "response_format=json", ] result = subprocess.run(cmd, capture_output=True, text=True) ``` ### Technical Analysis The OpenAI API key is placed directly in the argument vector of a spawned `curl` process. Although the authorization header is transmitted over HTTPS, putting the credential in the command-line arguments can expose it locally through process inspection facilities, monitoring agents, diagnostic tools, audit logs, or process telemetry. On systems where process arguments are visible to other users or services, the bearer token may be recovered while the `curl` process is running. The use of an argument array prevents shell injection, but it does not protect the confidentiality of arguments. Uploading selected audio to OpenAI is necessary for the declared cloud-transcription functionality and is disclosed in `SKILL.md`. The vulnerability is therefore not the network transmission itself, but the insecure local handling of the API credential. ### Attack Path 1. A user starts the voice-note transcription Skill. 2. The Skill spawns `curl` with the OpenAI bearer token embedded in its argument vector. 3. A local user, monitoring agent, or compromised process inspects process command lines while the request is active. 4. The observer extracts the API key from the `Authorization: Bearer ...` argument. 5. The stolen key is reused from another system to make requests under the victim's OpenAI ac ...[truncated 472 chars]- Remediation
View remediation
