T09 · Insecure Skill Coding Practices
- Location
scripts/test_model.py:70- Finding
API Credentials Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/test_model.py:70-76, 193-199; documented invocation atSKILL.md:39-42
Vulnerability Type: Sensitive information exposure through process arguments
Risk Level: HighVulnerable Code
python curl_cmd = [ "curl", "-s", "-X", "POST", test_url, "-H", "Content-Type: application/json", "-H", f"Authorization: Bearer {api_key}", "-d", json.dumps(payload), "--connect-timeout", "10", "--max-time", "30" ]python if __name__ == "__main__": if len(sys.argv) < 3: print("用法: test_model.py <provider_config_json> <model_id> [--test-tool-calling] [--test-streaming]") sys.exit(1) provider_config = json.loads(sys.argv[1]) model_id = sys.argv[2]The documented invocation also places the credential-bearing provider configuration directly in the command line:
bash python3 scripts/test_model.py '<provider_config_json>' '<model_id>' [--test-tool-calling] [--test-streaming]Equivalent credential-bearing
curlargument construction is also present in the optional tool-calling and streaming tests atscripts/test_model.py:122-128andscripts/test_model.py:164-170.Technical Analysis
The provider configuration contains the API key, but the interface requires that configuration to be supplied through
sys.argv. Command-line arguments can be retained in shell history and may be visible through process inspection, auditing systems, monitoring agents, crash reports, or command telemetry.The script subsequently creates a
curlchild process and embeds the API key in anAuthorizationheader passed as another command-line argument. This creates a second exposure window in which the bearer credential is present in the child process's argument vector.Although access to another process's command line depends on operating-system protections, user identity, and process-monitoring permissions, secrets should not be ...[truncated 1045 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not accept credential-bearing JSON through command-line arguments.
- Read provider configuration from standard input or from a file with mode
0600. - Prefer obtaining the API key from a protected environment variable or operating-system secret manager while ensuring it is not printed or logged.
- Replace the
curlsubprocess with an in-process HTTP client so authorization headers are not copied into a child process's argument vector. - If
curlmust be retained, provide headers through a protected temporary configuration file or standard input rather than-Hcommand-line arguments. - Update
SKILL.mdso examples never instruct users to place secrets directly in shell commands. - Redact credentials from exception messages, diagnostic output, telemetry, and debug logs.
- Recommend revocation and rotation of keys that have already been used through the current interface.
