T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
Credential Disclosure Through API Key Setup Instructions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly supports paid UpKuaJing trade queries, but its API-key handling and hidden version-check state create avoidable credential and privacy risks.
Install only if you are comfortable with a paid API skill that reads/writes `~/.upkuajing` and contacts UpKuaJing services. Do not print or paste the contents of `~/.upkuajing/.env`; use an environment variable or a tightly permissioned secret file, confirm any paid query or top-up action separately, and review error reports before sending them.
SKILL.md:37Credential Disclosure Through API Key Setup Instructions
scripts/auth.py:62API Key Stored Without Enforced Restrictive File Permissions
requirements.txt:1Unbounded Third-Party Dependency Version
Remote version checking, local metadata reads, cache-file writes, and upgrade notifications are outside the core trade-area query function and are not disclosed by the skill's purpose statement. This broadens network and file-write behavior in ways that can surprise users and may expose the environment to unnecessary remote contact and local state changes.
Remote version checking, local metadata reads, cache-file writes, and upgrade notifications are outside the core trade-area query function and are not disclosed by the skill's purpose statement. This broadens network and file-write behavior in ways that can surprise users and may expose the environment to unnecessary remote contact and local state changes.
Remote version checking, local metadata reads, cache-file writes, and upgrade notifications are outside the core trade-area query function and are not disclosed by the skill's purpose statement. This broadens network and file-write behavior in ways that can surprise users and may expose the environment to unnecessary remote contact and local state changes.
Remote version checking, local metadata reads, cache-file writes, and upgrade notifications are outside the core trade-area query function and are not disclosed by the skill's purpose statement. This broadens network and file-write behavior in ways that can surprise users and may expose the environment to unnecessary remote contact and local state changes.
The skill instructs reading ~/.upkuajing/.env directly and even shows cat ~/.upkuajing/.env, which encourages exposing raw secrets in plaintext. Any workflow that reads or prints the entire env file risks credential disclosure to the model, logs, transcripts, or other tools.
This skill requires an API key. The API key is stored in the ~/.upkuajing/.env file:
cat ~/.upkuajing/.env
Example file content:
The workflow directs the agent to inspect a local .env file for an API key and potentially participate in credential setup. Accessing and handling local secret files expands the skill beyond data retrieval into secret management, increasing the risk of accidental disclosure, overwrite, or misuse of credentials.
### **API Key Not Set**
First check if the `~/.upkuajing/.env` file has UPKUAJING_API_KEY;
If UPKUAJING_API_KEY is not set, prompt the user to choose:
1. User has one: User provides it (manually add to ~/.upkuajing/.env file)
2. User doesn't have one: You can apply using the interface (`auth.py --new_key`), the new key will be automatically saved to ~/.upkuajing/.env
Wait for user selection;
The skill states that obtaining a new key will automatically save it to ~/.upkuajing/.env, normalizing persistent plaintext secret storage on disk. Automatic credential writing to user home directories is risky because file permissions, backups, logs, or other local processes may expose the key, and users may not realize the persistence implications.
First check if the `~/.upkuajing/.env` file has UPKUAJING_API_KEY;
If UPKUAJING_API_KEY is not set, prompt the user to choose:
1. User has one: User provides it (manually add to ~/.upkuajing/.env file)
2. User doesn't have one: You can apply using the interface (`auth.py --new_key`), the new key will be automatically saved to ~/.upkuajing/.env
Wait for user selection;
### **Account Top-up**
The file implements authentication, account lookup, pricing, and recharge-order creation for a skill whose declared purpose is only paginated trade-area market analysis. This expands the capability surface beyond user expectations and introduces sensitive financial/account operations that could be invoked through the skill package.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
The script reads an existing .env file to inspect stored API keys, which is sensitive credential handling inside a skill that is not primarily an auth-management tool. Storing and processing secrets in plaintext local files increases exposure risk from local compromise, backups, logs, or accidental disclosure.
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
# 读取现有的 .env 文件
try:
with open(env_file, 'r', encoding='utf-8') as f:
content = f.read()
The script writes a newly issued API key directly into a local .env file, creating plaintext secret persistence on disk. This can expose credentials to other local users, malware, shell history/workspace leakage, backups, or accidental inclusion in archives and repositories.
"envFilePath": str(env_file)
}
# 保存到 .env 文件
try:
with open(env_file, 'w', encoding='utf-8') as f:
f.write(f"{API_KEY_ENV}={api_key}\n")
Creating recharge/payment orders is unrelated to a company trade-area query skill and gives the package a monetization/transaction capability not justified by its stated purpose. If exposed to users or agents, it could trigger unwanted billing flows or social-engineer operators into funding an account.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
API_BASE_URL = "https://openapi.upkuajing.com"
API_KEY_ENV = "UPKUAJING_API_KEY"
UPKUAJING_DIR = Path.home() / '.upkuajing'
UPKUAJING_ENV_FILE = UPKUAJING_DIR / '.env'
UPKUAJING_LOGS_DIR = UPKUAJING_DIR / 'logs'
# 日志开关
The skill declares capabilities that include environment access, filesystem interaction, and network use, but does not constrain them with an explicit tool scope such as allowed-tools or permissions. That increases the blast radius if the skill is misused, modified, or prompted into performing actions beyond its advertised purpose, especially because it also handles credentials and paid operations.
The document instructs agents to send request parameters, response payloads, and exception context to a centralized error-reporting API, which can include sensitive business data, identifiers, or stack traces. Although it notes that some sensitive fields are automatically masked, it does not require explicit minimization, user/operator notice, or clear prohibition on including confidential data, creating a real privacy and data-exposure risk if agents forward raw inputs and outputs during failures.
This file presents its description and operational messages in a single fixed language, which can violate a language/locale policy when no user opt-in or justification is provided. The same pattern continues throughout the CLI help and output strings, indicating the skill forces one locale rather than offering a choice.
The code can provision new API keys and persist them locally even though the skill is supposed to perform trade-area queries, not credential lifecycle management. This broadens privilege handling and increases the risk of unauthorized key issuance, misuse, or accidental exposure.
Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.
pass # 如果读取失败,继续执行
# 不需要认证申请新密钥
response = make_request('/agent/auth/create', {}, require_auth=False)
# 检查是否申请成功
if response.get('code') != 0:
Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.
pass # 如果读取失败,继续执行
# 不需要认证申请新密钥
response = make_request('/agent/auth/create', {}, require_auth=False)
# 检查是否申请成功
if response.get('code') != 0:
The file's natural-language documentation and user-facing messages are written exclusively in Chinese, which imposes a specific language/locale without any visible opt-in or alternative. Under the policy, a skill should not force a language choice unless it is explicitly justified or the user is given a choice.
This code posts the provided params to a remote API endpoint, which may include user or system data, but the function does not emit any user-facing notice or confirmation before transmission. Although there is a docstring describing the HTTP request, there is no runtime disclosure to the user about outbound data transfer in this code path.