T09 · Insecure Skill Coding Practices
- Location
.- Finding
API Credentials May Be Exposed Through Command-Line Arguments and URLs
- Content
View full analysis
Vulnerability Details
File Locations:
anthropic.md:50-61cohere.md:39-47deepseek.md:37-45google.md:48-52mistral.md:46-56openai.md:70-80
Vulnerability Type: API credential exposure through process arguments and URL logging
Risk Level: LowVulnerable Code
anthropic.md:50-61bash curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-4-6", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}] }'cohere.md:39-47bash curl https://api.cohere.com/v2/chat \ -H "Authorization: Bearer $COHERE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "command-a-reasoning", "messages": [{"role": "user", "content": "Hello"}] }'deepseek.md:37-45bash curl https://api.deepseek.com/chat/completions \ -H "Authorization: Bearer $DEEPSEEK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-chat", "messages": [{"role": "user", "content": "Hello"}] }'google.md:48-52bash curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=$GOOGLE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"contents": [{"parts": [{"text": "Hello"}]}]}'mistral.md:46-56bash curl https://api.mistral.ai/v1/chat/completions \ -H "Authorization: Bearer $MISTRAL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "mistral-small-latest", "messages": [{"role": "user", "content": "Hello"}] }'openai.md:70-80bash curl https://api.openai.com/v1/chat/completions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt ...[truncated 2311 chars]- Remediation
View remediation
Remediation Suggestions
- Prefer provider SDK examples that read credentials directly from environment variables without placing their values in command-line arguments.
- For
curl, load sensitive headers from a permission-restricted configuration file or protected file descriptor rather than an inline-Hargument. - Avoid query-string credentials wherever the provider supports a header-based authentication mechanism.
- Add an explicit warning that examples should be tested with restricted, disposable development keys rather than unrestricted production credentials.
- Recommend provider-side controls such as API restrictions, minimum required scopes, spending caps, rate limits, source restrictions, rotation, and expiration.
- Advise users to disable shell tracing and verify that command, proxy, and endpoint telemetry will not retain secrets.
- Redact authorization headers and credential-bearing URLs from examples, logs, screenshots, issue reports, and diagnostic output.
