T09 · Insecure Skill Coding Practices
- Location
scripts/make_video.py:12- Finding
API Credentials Exposed Through Command Logging and Process Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/make_video.py:12-14,scripts/make_video.py:70-100, andscripts/make_video.py:112-143
Vulnerability Type: Sensitive credential exposure
Risk Level: MediumVulnerable Code
python def run(cmd, cwd=None): print(f"+ {' '.join(cmd)}", flush=True) subprocess.check_call(cmd, cwd=cwd)python cmd = [ "curl", "-sS", "-X", "POST", "https://api.openai.com/v1/audio/speech", "-H", f"Authorization: Bearer {api_key}", "-H", "Content-Type: application/json", "-d", "{}", "--output", str(out_mp3), ] payload = { "model": model, "voice": voice, "format": "mp3", "input": text, } import json as _json cmd[cmd.index("{}") if "{}" in cmd else -3] = _json.dumps(payload, ensure_ascii=False) run(cmd)python run([ "curl", "-sS", "-X", "POST", url, "-H", f"xi-api-key: {api_key}", "-H", "Content-Type: application/json", "-H", "Accept: audio/mpeg", "-d", _json.dumps(payload, ensure_ascii=False), "--output", str(out_mp3), ])Technical Analysis
The common
run()helper prints every command-line argument before execution. The OpenAI and ElevenLabs implementations place API keys directly inside HTTP header arguments passed tocurl. Consequently, the complete credentials are printed in plaintext to the terminal and may be retained in shell captures, CI logs, agent execution logs, or centralized logging systems.The credentials are also present in the
curlprocess argument vector while the request is running. Depending on operating-system process visibility and isolation settings, another local process or same-user process monitor may be able to read them.Sending narration to the explicitly selected remote TTS provider is necessary for those op ...[truncated 1216 chars]
- Remediation
View remediation
Remediation Suggestions
- Change command logging so sensitive headers and credentials are replaced with fixed redaction markers before output.
- Avoid placing credentials in process arguments. Prefer an in-process HTTPS client that sets authorization headers through an API rather than through an external command line.
- If
curlmust remain in use, supply a restrictive temporary configuration through standard input or another mechanism that does not expose secrets in the argument vector. - Ensure any temporary credential-bearing data is created with owner-only permissions and removed immediately after use.
- Add automated tests confirming that OpenAI and ElevenLabs keys never appear in stdout or stderr.
- Rotate any API credentials previously used in environments where execution output was retained.
