T09 · Insecure Skill Coding Practices
- Location
scripts/video_generate.py:317- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill does what it says: it uses a Juhe API key to generate videos, polls the service, and saves the finished MP4 locally, with some credential-handling cautions users should follow.
Install only if you are comfortable sending prompts, image URLs or base64 images, optional audio URLs, and your Juhe API key to the Juhe video service. Prefer JUHE_VIDEO_KEY over --key, avoid committing scripts/.env, consider using --no-download when you only need a link, and choose the output directory deliberately because generated videos are saved locally by default.
scripts/video_generate.py:317API Key Exposure Through Command-Line Arguments
The documentation encourages storing the API key in a plaintext scripts/.env file within the project directory. Plaintext secrets in working directories are commonly exposed through accidental commits, backups, logs, or overly broad file access by other tools.
# 方式一:环境变量(推荐,一次配置永久生效)
export JUHE_VIDEO_KEY=你的AppKey
# 方式二:.env 文件(在脚本目录创建)
echo "JUHE_VIDEO_KEY=你的AppKey" > scripts/.env
# 方式三:每次命令行传入
The example shows passing the API key directly on the command line with --key, which can leak secrets via shell history, process listings, audit logs, and agent telemetry. In multi-user or monitored environments, command-line arguments are a well-known secret exposure channel.
export JUHE_VIDEO_KEY=你的AppKey
# 方式二:.env 文件(在脚本目录创建)
echo "JUHE_VIDEO_KEY=你的AppKey" > scripts/.env
# 方式三:每次命令行传入
python scripts/video_generate.py --key 你的AppKey "夕阳下的海边"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
API Key 配置(任选其一,优先级从高到低):
1. 环境变量: export JUHE_VIDEO_KEY=your_api_key
2. 脚本同目录的 .env 文件: JUHE_VIDEO_KEY=your_api_key
3. 直接传参: python video_generate.py --key your_api_key "提示词"
免费申请 API Key: https://www.juhe.cn/docs/api/id/827
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
API Key 配置(任选其一,优先级从高到低):
1. 环境变量: export JUHE_VIDEO_KEY=your_api_key
2. 脚本同目录的 .env 文件: JUHE_VIDEO_KEY=your_api_key
3. 直接传参: python video_generate.py --key your_api_key "提示词"
免费申请 API Key: https://www.juhe.cn/docs/api/id/827
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()
The skill documents access to environment variables, local file output, and network/API usage, but it does not declare any explicit tool scope or allowed-tools boundary. That omission weakens least-privilege controls and can cause the agent runtime to grant broader capabilities than users or reviewers expect.
The skill states that generated MP4 files are automatically downloaded to local storage, but it does not clearly warn about persistence, naming collisions, disk usage, or where sensitive/generated content will be stored. Automatic local writes are risky in agent contexts because they create side effects beyond returning a result to the user.
The trigger guidance is broad enough to match common requests like 'create/generate/make a video,' which increases the chance of accidental invocation. In an agent environment, overbroad activation can lead to unintended network calls, billing consumption, and local file writes without sufficiently specific user intent.
This code file contains natural-language instructions, usage text, and operational messages entirely in Chinese, and there is no indication that the skill is region-specific or that users can opt into another language. Under the policy, forcing a specific language without user choice is a natural-language policy violation.
No suspicious patterns detected.