T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_company-info.py:75- Finding
API Key Exposure Through URL Query Parameters and Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/fetch_company-info.py:75-80,scripts/fetch_company-info.py:105, andSKILL.md:24-30,43
Vulnerability Type: Sensitive credential exposure
Risk Level: MediumVulnerable Code
python params = { "key": self.api_key, "com": com.strip() } query_string = urllib.parse.urlencode(params) url = f"{API_ENDPOINT}?{query_string}"The script also accepts the API key through the
--keycommand-line option, and the documentation recommends invoking the script with the secret directly on the command line. It additionally documents storing the key in a plaintextscripts/.envfile without requiring restrictive file permissions.Technical Analysis
The API key is placed directly in the request URL as a query parameter. Although the endpoint uses HTTPS, HTTPS only protects the request while it is in transit. URLs may still be captured by the API provider, reverse proxies, monitoring infrastructure, debugging output, or request logs. Any component that records the complete request target can retain the credential.
Command-line transmission introduces an additional local exposure path. Depending on the operating system and shell configuration, arguments may be retained in shell history or temporarily visible through process-inspection facilities. The documented plaintext
.envconfiguration can also expose the key to other local users or processes if the file is created with permissive permissions.Sending the company identifier and API key to TianAPI is necessary for the Skill's declared remote company-information lookup. The outbound request is limited to the documented provider and no transmission to an unrelated destination was identified. However, the credential-handling methods exceed the minimum safe exposure needed to perform that request.
Attack Path
- A user follows the documentation and supplies the TianAPI key through the
--keycomm ...[truncated 1146 chars]
- A user follows the documentation and supplies the TianAPI key through the
- Remediation
View remediation
Remediation Suggestions
- Remove the documented recommendation to pass API keys through command-line arguments and consider removing the
--keyoption entirely. - Prefer
TIANAPI_COMPANY_KEYsupplied through a managed secret store or a narrowly scoped runtime environment. - If
.envsupport remains necessary, document and enforce restrictive file permissions such as0600. Ensure the file is excluded from source control. - Use an authorization header instead of a query parameter if TianAPI supports that authentication method.
- If query-string authentication is required by the provider, ensure URLs are never written to application logs, exception reports, telemetry, or debugging output.
- Apply strict redirect handling so credentials cannot be forwarded to an unexpected origin.
- Use a dedicated, least-privileged TianAPI key restricted to the company-information API when provider controls permit it.
- Rotate the key immediately if it has previously appeared in command history, logs, shared terminal output, or a publicly accessible
.envfile. - Correct the positional-argument example in
SKILL.md:43, which does not match the script's required--keyand--comoptions.
- Remove the documented recommendation to pass API keys through command-line arguments and consider removing the
