T09 · Insecure Skill Coding Practices
- Location
scripts/enterprise_detail.py:198- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does what it claims, but it encourages API key handling that can expose the user's paid Juhe credential locally.
Install only if you are comfortable sending queried company names or identifiers to Juhe.cn. Configure the key with JUHE_ENTERPRISE_DETAIL_KEY instead of --key, avoid putting keys in command history or URLs, and protect any local .env file with restrictive permissions.
scripts/enterprise_detail.py:198API Key Exposure Through Command-Line Arguments
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
API Key 配置(任选其一,优先级从高到低):
1. 命令行参数:python enterprise_detail.py --key your_api_key --keyword 企业全名
2. 环境变量:export JUHE_ENTERPRISE_DETAIL_KEY=your_api_key
3. 脚本同目录的 .env 文件:JUHE_ENTERPRISE_DETAIL_KEY=your_api_key
申请 API Key: https://www.juhe.cn/docs/api/id/319
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
API Key 配置(任选其一,优先级从高到低):
1. 命令行参数:python enterprise_detail.py --key your_api_key --keyword 企业全名
2. 环境变量:export JUHE_ENTERPRISE_DETAIL_KEY=your_api_key
3. 脚本同目录的 .env 文件:JUHE_ENTERPRISE_DETAIL_KEY=your_api_key
申请 API Key: https://www.juhe.cn/docs/api/id/319
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
API Key 配置(任选其一,优先级从高到低):
1. 命令行参数:python enterprise_detail.py --key your_api_key --keyword 企业全名
2. 环境变量:export JUHE_ENTERPRISE_DETAIL_KEY=your_api_key
3. 脚本同目录的 .env 文件:JUHE_ENTERPRISE_DETAIL_KEY=your_api_key
申请 API Key: https://www.juhe.cn/docs/api/id/319
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
API Key 配置(任选其一,优先级从高到低):
1. 命令行参数:python enterprise_detail.py --key your_api_key --keyword 企业全名
2. 环境变量:export JUHE_ENTERPRISE_DETAIL_KEY=your_api_key
3. 脚本同目录的 .env 文件:JUHE_ENTERPRISE_DETAIL_KEY=your_api_key
申请 API Key: https://www.juhe.cn/docs/api/id/319
"""
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if env_key:
return env_key
env_file = Path(__file__).parent / ".env"
if env_file.exists():
for line in env_file.read_text(encoding="utf-8").splitlines():
line = line.strip()
Without declared permissions the skill's intent is opaque and cannot be validated.
The invocation examples include broad phrases like "查一下这家公司详细信息", "股东和法人", "经营范围", and "变更记录", which are common everyday requests and are not specific enough to clearly indicate this exact skill should activate. Although the description mentions precise enterprise lookup, it does not provide explicit exclusion examples for when these generic phrases should not trigger the skill.
The skill sends enterprise names, registration numbers, or unified social credit codes to a third-party API, but the markdown does not clearly warn users that these identifiers leave the local system. This creates a privacy and data-handling risk because users may provide sensitive corporate identifiers without informed consent.
The script sends the user-supplied enterprise identifier or company name, along with the API key, to a third-party service (juhe.cn) but provides no runtime notice or consent mechanism about external data sharing. In a skill context, users may assume the lookup is local or platform-native, so this creates a privacy and data-handling risk, especially if queried entities or identifiers are sensitive in the user's environment.
The natural-language interface, usage text, and error/help messages are all written in Chinese, with no indication that other languages are supported or that the locale is intentionally restricted. Under the stated policy, forcing a language without user opt-in is a natural-language policy concern.