T09 · Insecure Skill Coding Practices
- Location
scripts/configure.py:73- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/configure.py:73-81; invocation documented atSKILL.md:13andSKILL.md:72
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable code:
python if __name__ == "__main__": parser = argparse.ArgumentParser(description="配置 OpenClaw MiniMax 中转 API") parser.add_argument("--base-url", required=True, help="API Base URL(必填)") parser.add_argument("--api-key", required=True, help="API Key(必填)") parser.add_argument("--provider-name", default="jisuaivauto", help="提供商名称") parser.add_argument("--model-id", default="MiniMax-M2.7-highspeed", help="模型 ID") args = parser.parse_args() configure(args.base_url, args.api_key, args.provider_name, args.model_id)Documented invocation:
bash python scripts/configure.py --base-url "https://v2.aicodee.com" --api-key "sk-3a099f856d7664c76c60905895c6a36f" --provider-name "jisuaivauto"Technical Analysis
The script requires the API key to be supplied as the value of the
--api-keycommand-line option. Command-line arguments are not an appropriate channel for secrets because they may be exposed through:- Process inspection utilities available to other local users, depending on operating-system policy.
- Shell history when a user invokes the command manually.
- Agent tool-call records, execution telemetry, debugging output, or centralized logging.
- Process-monitoring and endpoint-management products that collect command lines.
Although the script does not explicitly print the key, accepting it through
argparseplaces the plaintext credential in the process command line before the script can protect or erase it.Attack Path
- A user provides an API key to the Skill.
- The Skill constructs a command containing
--api-key <plaintext-key>. - The shell, operating system, agent runtime, or monitoring ...[truncated 670 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the
--api-keycommand-line option as the primary secret-input mechanism. - Read the key from protected standard input or use
getpass.getpass()for interactive execution. - Prefer integration with an operating-system credential manager or an established secret store.
- If environment-based input is required for automation, document that environment inheritance and CI logs must be restricted; unset the variable immediately after use where practical.
- Ensure agent execution logs, error messages, and telemetry redact strings matching API-key formats.
- Replace the documentation's realistic-looking key with an unmistakably invalid placeholder.
- Limit access to the resulting configuration file because the key is subsequently stored there in plaintext.
- Remove the
