T09 · Insecure Skill Coding Practices
- Location
scripts/common.py:45- Finding
Partial API Key Disclosure Through Diagnostic Logs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears to perform its stated ModelScope AI tasks, but it has avoidable security risks around API-key logging, third-party data upload, and trusting remote image download URLs.
Review before installing. Use this only if you are comfortable sending prompts, images, OCR targets, and chat history to ModelScope, and avoid sensitive files unless approved. Consider patching the API-key prefix logging, adding URL and image-size validation for downloads, and installing dependencies in an isolated pinned environment.
scripts/common.py:45Partial API Key Disclosure Through Diagnostic Logs
scripts/generate.py:157Unvalidated Server-Provided Image Download URL
SKILL.md:21Unpinned Third-Party Dependency Installation
代码行为与描述部分重合:它确实通过 ModelScope API 实现了文生图、图生图,并支持在失败/限速场景下结合 key 与模型进行轮换,这与声明中的一部分一致。但声明将技能描述为同时支持‘析图/视觉理解’和‘生文/文本生成’,而该代码仅调用 v1/images/generations 图像生成接口,处理输入图片也是为了图生图编辑,并没有任何图像理解、OCR、描述生成、问答或文本生成相关接口调用与逻辑。因此声明的能力范围明显大于实际代码实现,属于描述与实际行为不一致。
The description claims a multi-capability skill for image generation, image editing, visual understanding, and text generation. However, this code chunk only performs text/chat generation against a chat completions endpoint. It accepts text prompts, optional chat history, streams text responses, and rotates across API keys and text models when rate-limited. There is no image input handling, no image output generation, no vision endpoint usage, and no image-processing logic. The auto-rotation claim is supported, but the declared overall capability set is materially broader than the actual behavior shown in this code chunk.
The code matches only the '析图/视觉理解' portion of the description and does include model/key rotation behavior. However, the declared purpose describes a multi-function skill for image generation, image editing, visual understanding, and text generation. This specific code chunk only performs image analysis by packaging an image plus prompt to vision-capable chat models and returning textual analysis. There is no implementation for creating images from text, transforming images, or general text-generation workflows unrelated to image input. Therefore the description overstates the implemented capabilities of this code chunk in a materially significant way.
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
用法:
单轮: python3 text.py --prompt "解释量子计算"
多轮: python3 text.py --prompt "继续" --history history.json
指定模型: python3 text.py --prompt "你好" --model kimi
流式: python3 text.py --prompt "写一首诗" --stream
"""
The README advertises image upload, OCR, visual analysis, and text generation backed by an external AI service, but it does not warn users that prompts and uploaded images may be transmitted to a third-party API. This can lead to unintentional disclosure of sensitive personal, corporate, or regulated data, especially because OCR and image analysis often involve documents, screenshots, or photos containing secrets.
The README instructs users to install/run tooling via npx clawhub without pinning an exact version. This creates a supply-chain risk because users may fetch whatever version is current at execution time, including a compromised or unexpectedly changed release.
The skill documentation describes capabilities that require access to environment variables, local files, and outbound network requests, but it does not declare any explicit tool scope such as permissions or allowed-tools. This creates an overbroad and implicit trust boundary: a host may grant more capability than users or reviewers expect, making secret exposure, unintended file writes, or external API calls harder to govern.
The natural-language description and operating instructions force a specific language/locale for users and agents consuming the skill. Under the policy, locale constraints should either be optional, justified as region-specific, or provide a language choice; this file does not do so.
This code file contains user-facing natural-language strings and documentation entirely in Chinese, including setup/error guidance, which effectively imposes a specific language on users. The policy for SQP-3 flags language or locale constraints when the skill does not provide an explicit user choice or opt-in.
When used in image-to-image mode, local image files are base64-encoded and sent to the external ModelScope API, but the script provides no explicit user-facing disclosure or confirmation at the point of upload. This can cause unintentional exfiltration of sensitive local images, especially in an agent/skill context where users may not realize their files are being transmitted off-host.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
}
try:
resp = requests.post(
f"{BASE_URL}chat/completions",
headers=headers, json=payload, timeout=120, stream=stream,
)
The script sends the user prompt and any loaded chat history to a third-party API endpoint, but it does not provide an explicit user-facing privacy notice or confirmation step before transmission. In a skill context, users may unknowingly include sensitive data in prompts or history files, causing unintentional disclosure to an external provider.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
}
try:
resp = requests.post(f"{BASE_URL}v1/chat/completions", headers=headers, json=payload, timeout=120)
if resp.status_code == 429:
return {"status": "rate_limit"}
The docstring, help text, and user-facing messages are presented only in Chinese, with no indication that users may choose another language. This creates a locale/language policy issue under the rule because the skill enforces a specific language rather than offering a choice or documenting a justified regional constraint.
When --output is used, the full conversation is written to disk as JSON without any explicit warning that potentially sensitive prompts and model responses will be persisted locally. This can expose private data to other local users, backups, or later unintended reuse.
No suspicious patterns detected.