T09 · Insecure Skill Coding Practices
- Location
scripts/transcribe.py:86- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/transcribe.py:86-94; documented usage atSKILL.md:41-43
Vulnerability Type: Credential exposure through process arguments and shell history
Risk Level: MediumVulnerable Code
scripts/transcribe.py:86-94:python parser.add_argument("--api-key", "-k", help="SiliconFlow API Key (也可设置环境变量 SILICONFLOW_API_KEY)") parser.add_argument("--output", "-o", help="输出文件路径 (默认输出到 stdout)") parser.add_argument("--json", action="store_true", help="以 JSON 格式输出") args = parser.parse_args() # 获取 API Key api_key = args.api_key or os.environ.get("SILICONFLOW_API_KEY", "") if not api_key:SKILL.md:41-43:bash # 指定 API Key python3 scripts/transcribe.py audio.mp3 --api-key sk-xxxTechnical Analysis
The script accepts a sensitive SiliconFlow API key as a command-line argument, and the documentation explicitly recommends this invocation method. Command-line arguments are not an appropriate secret transport mechanism because they may be:
- Recorded in shell history.
- Captured by command-execution telemetry or audit logs.
- Visible to sufficiently privileged local users through process inspection facilities while the command is running.
- Retained in terminal session logs or automation logs.
The API key is not hardcoded or intentionally transmitted anywhere other than the declared SiliconFlow API endpoint. Nevertheless, accepting and documenting command-line secret input unnecessarily increases credential exposure. The already-supported
SILICONFLOW_API_KEYenvironment variable is safer than the documented argument, although protected credential storage or an interactive secret prompt would be preferable.Attack Path
- A user follows the documented example and invokes the script with
--api-key sk-xxx. - The complete command is stored in shell history, execution telemetry, a process listing, or an automation log.
- An ...[truncated 847 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove or deprecate the
--api-keycommand-line option. - Remove the command-line API-key example from
SKILL.md. - Prefer a secret supplied through a protected credential manager or configuration file with restrictive permissions.
- If an environment variable remains supported, document that it should be set without placing the key directly in reusable shell commands.
- Optionally use
getpass.getpass()to request the credential interactively when no protected configuration is available. - If backward compatibility requires retaining
--api-key, emit a clear warning explaining that command-line secrets may be exposed through shell history, process inspection, and logs. - Rotate any key that has already been placed in shared shell history, CI logs, or execution telemetry.
- Remove or deprecate the
