T09 · Insecure Skill Coding Practices
- Location
reference/shared.md:62- Finding
API Key Exposure Through Command-Line Arguments and Plaintext Configuration
- Content
View full analysis
Vulnerability Details
File Location:
reference/shared.md, lines 62-65
Vulnerability Type: Sensitive credential exposure
Risk Level: Mediumbash # Agent non-interactive initialization can explicitly write request source and runtime configuration: mediakit-cli init --mode cloud-first --api-key <key> --runtime <runtime> --surface cli --yes mediakit-cli init --mode local-first --api-key <key> --endpoint <url> --output-path ~/mediakit-output --runtime <runtime> --surface cli --credential-store config --yesTechnical Analysis
The documented initialization commands pass the MediaKit API key through the
--api-keycommand-line argument. Secrets supplied as command-line arguments may be exposed through:- Shell history files
- Process inspection utilities while the command is running
- Agent execution traces and terminal session logs
- Process accounting or endpoint-monitoring systems
- Error reports that capture the complete command
The second example additionally selects
--credential-store config. The documentation identifies the configuration file as~/.mediakit/config.json, but it does not state that owner-only permissions are enforced or that credentials are encrypted at rest.This is an insecure credential-handling pattern. The finding does not establish that the CLI itself logs or mishandles the key; the confirmed issue is that the Skill explicitly recommends placing the key in a command-line argument and potentially storing it in a configuration file without documenting storage protections.
Attack Path
- A user or Agent follows the documented non-interactive initialization procedure.
- The MediaKit API key is included in the process argument list and potentially recorded in shell history or execution logs.
- A local user, monitoring process, support-log recipient, or other actor with access to those records retrieves the key.
- The actor uses the recovered credential to authenticate t ...[truncated 814 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not pass API keys through command-line arguments.
- Prefer a protected environment variable, an interactive secret prompt that disables terminal echo, or an operating-system credential manager.
- If non-interactive initialization is required, accept the secret through standard input or a dedicated file descriptor rather than the process argument list.
- Prevent secret values from appearing in command traces, debug logs, telemetry, and error messages.
- If configuration-file storage remains supported, enforce owner-only permissions such as mode
0600on Unix-like systems. - Prefer encryption backed by the operating system’s native credential store rather than plaintext JSON storage.
- Document credential rotation and revocation procedures.
- Update the example to use a placeholder environment reference without expanding the secret into a logged command.
