T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_obdcode.py:72- Finding
API Credential Transmitted in the URL Query String
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This OBD lookup skill appears purpose-aligned, but it has material credential-handling weaknesses and a broken executable script that users should review before installing.
Review before installing. Prefer setting TIANAPI_OBDCODE_KEY as an environment variable, avoid passing the key on the command line, do not create scripts/.env unless it is owner-readable and excluded from version control, and rotate the key if it appears in shell history or logs. This version also needs a code fix before the bundled script will run.
scripts/fetch_obdcode.py:72API Credential Transmitted in the URL Query String
scripts/fetch_obdcode.py:111API Key Accepted Through Process Arguments and Potentially Permissive Credential File
scripts/fetch_obdcode.py:57Invalid Markup Embedded in Python Source Prevents Skill Execution
This finding reflects credential handling guidance that places a live API key into a local .env file. While the skill is not directly stealing credentials, it encourages a pattern that materially increases the chance of credential disclosure and subsequent unauthorized API use, billing abuse, or account misuse.
# 方式一:环境变量(推荐,一次配置永久生效)
export TIANAPI_OBDCODE_KEY=你的APIKey
# 方式二:.env 文件(在脚本目录创建)
echo "TIANAPI_OBDCODE_KEY=你的APIKey" > scripts/.env
# 方式三:每次命令行传入
The documentation immediately follows the .env example with a command-line example using the API key directly, reinforcing insecure secret exposure paths. In context, this is more dangerous because the skill is specifically designed to consume an external secret and provides multiple unsafe ways to surface that secret during normal use.
export TIANAPI_OBDCODE_KEY=你的APIKey
# 方式二:.env 文件(在脚本目录创建)
echo "TIANAPI_OBDCODE_KEY=你的APIKey" > scripts/.env
# 方式三:每次命令行传入
python3 scripts/fetch_obdcode.py --key 你的APIKey --code P267B
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_OBDCODE_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_OBDCODE_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_OBDCODE_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_OBDCODE_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_OBDCODE_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_OBDCODE_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_OBDCODE_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_OBDCODE_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
return env_val
# 2. .env 文件
env_file = Path(__file__).parent / ".env"
if env_file.exists():
try:
content = env_file.read_text(encoding="utf-8")
The skill documents use of environment variables, local files, and outbound network/API access, but it does not declare any explicit tool scope or allowed-tools/permissions. This weakens least-privilege controls because an agent or platform may permit broader capability use than readers expect, increasing the chance of unintended file access, secret handling, or network exfiltration if the skill is invoked automatically.
The documentation instructs users to write the API key into scripts/.env in plaintext without any warning about file permissions, git exclusion, or secret management. Plaintext credential storage is dangerous because the key can be accidentally committed, read by other local users/processes, or exposed through backups and logs.
The examples show passing the API key on the command line and in a URL query string, both of which can leak secrets through shell history, process listings, terminal logs, proxies, browser history, or HTTP server/access logs. Even if intended as convenience documentation, this trains users into insecure secret-handling patterns.
The .env parsing implementation is broken: line.split("=", 1) returns a list, so calling .strip() on it raises an exception that is silently swallowed. This can cause operators to believe secrets are loaded from .env when they are not, leading to misconfiguration and accidental fallback to less safe key handling such as passing secrets on the command line.
This code file performs an outbound HTTP request and includes the API key in the request parameters, but the script provides no user-facing warning beyond basic usage text that the credential will be sent to TianAPI. Under the code-file criteria, network transmission of user or system data should have some disclosure unless clearly warned or documented.
The natural-language instructions and descriptions in the module docstring are predominantly Chinese, and the file does not indicate that this language restriction is intentional or offer any user language choice. The policy requires avoiding forced language/locale constraints unless the constraint is explicit and justified.
No suspicious patterns detected.