T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
Documentation Instructs the Agent to Print a Complete Credential File
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a real paid API client for education-history lookup, but it handles credentials and account/payment flows too broadly for a hiring background-check tool.
Review this before installing in an HR or enterprise environment. Do not let the agent print ~/.upkuajing/.env, prefer injecting UPKUAJING_API_KEY through a secure secret mechanism, restrict file permissions if a local key file is used, and require explicit human approval for any paid query, top-up order, or error report that may include candidate data.
SKILL.md:37Documentation Instructs the Agent to Print a Complete Credential File
scripts/auth.py:72API Key File Is Written Without Explicit Restrictive Permissions
requirements.txt:1Unbounded and Unverified Third-Party Dependency Installation
The finding indicates software/version update checking and cache writes that are unrelated to the stated education-verification function. Even if operationally useful, undocumented update checks introduce additional outbound network traffic and local state changes outside the user’s expected task flow.
The finding indicates software/version update checking and cache writes that are unrelated to the stated education-verification function. Even if operationally useful, undocumented update checks introduce additional outbound network traffic and local state changes outside the user’s expected task flow.
The finding indicates software/version update checking and cache writes that are unrelated to the stated education-verification function. Even if operationally useful, undocumented update checks introduce additional outbound network traffic and local state changes outside the user’s expected task flow.
The finding indicates software/version update checking and cache writes that are unrelated to the stated education-verification function. Even if operationally useful, undocumented update checks introduce additional outbound network traffic and local state changes outside the user’s expected task flow.
The skill instructs reading the API key from ~/.upkuajing/.env and even demonstrates accessing the file contents directly. Direct credential file access is dangerous because it can expose secrets to the agent, logs, or downstream tooling beyond what is necessary for making the API call.
This skill requires an API key. The API key is stored in the ~/.upkuajing/.env file:
cat ~/.upkuajing/.env
Example file content:
The workflow tells the agent to check for the API key in a local .env file and, if absent, create a new key that is automatically saved there. This is dangerous because it combines credential discovery, credential provisioning, and local secret persistence in a user-task skill, increasing the risk of unauthorized secret handling and long-lived exposure on disk.
### **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 instruction to inspect ~/.upkuajing/.env for UPKUAJING_API_KEY encourages local secret enumeration as part of normal execution. In this HR context, that is more dangerous because the skill already processes sensitive personal data, so combining credential access with personal-data queries creates a stronger privacy and misuse risk.
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**
This file implements API key issuance, account lookup, pricing, and recharge/payment flows that are unrelated to the stated education-verification purpose of the skill. In a skill intended for HR background checks, adding billing and platform-auth management expands the attack surface and suggests hidden external service dependency or undisclosed monetized operations, which is dangerous because users may invoke capabilities they did not intend to trust.
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 code reads the entire .env file and parses out an API key, then later includes part of the existing key in a user-facing message. Storing and handling credentials in plaintext .env files increases exposure risk on multi-user systems, in backups, or if file permissions are weak; partial disclosure also leaks identifying secret material that can aid attackers.
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 code writes a newly issued API key directly to a plaintext .env file under the user's home directory. Plaintext credential storage is dangerous because local compromise, permissive file permissions, backups, logs, or developer tooling can disclose the key, enabling unauthorized API access and abuse of the linked account.
"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")
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 advertises code-capable behavior that includes environment access, file reads/writes, and network use, but it does not declare an explicit tool scope or permissions boundary. That creates an authorization ambiguity where a reviewer or runtime may not clearly constrain what the skill is allowed to touch, increasing the risk of unintended credential, filesystem, or network access.
The manifest frames the skill as HR-focused verification for hiring, but the actual behavior is a generic person-education lookup for any person ID in a broad people database. In context, that makes the skill more dangerous because it normalizes access to potentially sensitive personal education data under a narrower, legitimacy-enhancing HR framing.
The skill includes account-management and paid transaction capabilities, such as key creation and top-up workflows, that are not justified by the stated education-verification purpose. This increases the blast radius from simple data retrieval to account provisioning and financial actions, which can be abused or triggered unexpectedly.
The document instructs callers to send request parameters, response data, and exception context to a centralized error-reporting API, which can easily include candidate PII, education records, tokens, stack traces, and other sensitive operational data. Although it claims sensitive fields are automatically redacted, it does not define the redaction scope or require user/operator warning, minimization, or explicit exclusion of regulated personal data, creating a real privacy and data-leak risk in an HR background-check context.
This code file contains natural-language strings that define the skill description and CLI help/output entirely in Chinese. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is clearly documented and justified, which is not present here.
Using require_auth=False for credential provisioning is an unsafe default because it creates a privileged resource without prior trust establishment. Even if the backend intends to allow self-service signup, embedding this behavior in a seemingly unrelated HR verification skill increases the likelihood of silent third-party service enrollment and misuse.
pass # 如果读取失败,继续执行
# 不需要认证申请新密钥
response = make_request('/agent/auth/create', {}, require_auth=False)
# 检查是否申请成功
if response.get('code') != 0:
Using require_auth=False for credential provisioning is an unsafe default because it creates a privileged resource without prior trust establishment. Even if the backend intends to allow self-service signup, embedding this behavior in a seemingly unrelated HR verification skill increases the likelihood of silent third-party service enrollment and misuse.
pass # 如果读取失败,继续执行
# 不需要认证申请新密钥
response = make_request('/agent/auth/create', {}, require_auth=False)
# 检查是否申请成功
if response.get('code') != 0:
Recharge-order creation and account-balance retrieval are not justified by the advertised function of verifying candidate education records. Exposing payment-related functions inside a hiring verification skill can lead to unauthorized purchases, social-engineering opportunities, and misuse of enterprise funds if the skill is triggered in automated or delegated workflows.
This code file contains natural-language descriptions and later user-visible error/output strings exclusively in Chinese, starting with the module docstring. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, which is not present here.