T09 · Insecure Skill Coding Practices
- Location
scripts/generate_image.py:85- Finding
Arbitrary Local File Disclosure Through Unvalidated Python Image Input
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This image tool appears to do its advertised job, but it can upload any local file path it is given to a third-party API without validating that the file is really an image.
Review before installing. Use this only with images and prompts you are comfortable sending to APIYi, avoid passing sensitive file paths, and run it in a restricted workspace where the process cannot read credentials, private keys, or unrelated documents. Prefer an environment variable for the API key rather than the command-line flag, and confirm which backend/provider you expect to process the images.
scripts/generate_image.py:85Arbitrary Local File Disclosure Through Unvalidated Python Image Input
scripts/generate_image.js:153Arbitrary Local File Disclosure Through Unvalidated Node.js Image Input
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
print(f"输出请求参数: {json.dumps(payload_log, indent=2, ensure_ascii=False)}")
print(f"image generation in progress...")
try:
response = requests.post(url, headers=headers, json=payload, timeout=400)
response.raise_for_status()
data = response.json()
Referenced artifact was not completely inspected
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。
Referenced artifact was not completely inspected
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。
Referenced artifact was not completely inspected
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。
Referenced artifact was not completely inspected
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。
Referenced artifact was not completely inspected
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。
Referenced artifact was not completely inspected
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。
Referenced artifact was not completely inspected
- **优先尝试 Node.js 版本**:如果环境有 Node(`node` 命令可用),优先使用 `scripts/generate_image.js`(零依赖,参数与 Python 保持一致)。
The skill instructs the agent to use environment variables and make outbound network requests to a third-party image generation proxy, but it does not declare any explicit tool scope or allowed-tools boundary. In an agent ecosystem, missing permission declarations weakens least-privilege controls and can allow broader-than-intended access to secrets or network capabilities during execution.
The natural-language content of the skill, including its description, usage instructions, and examples, is presented only in Chinese. Under the policy, forcing a specific language without giving the user an explicit choice or documenting a justified locale restriction is a natural-language policy violation.
L034-L035 instructs that the default resolution is 2K, suggesting the skill should actively use 2K unless otherwise specified. But L152 says that if resolution is omitted, it is not included in the request and the API side decides; L178 also labels the default as 2K. These statements conflict on actual behavior and can mislead operators about what the skill does.
The API key guidance is contradictory and includes passing the secret on the command line, which is commonly exposed via shell history, process listings, logs, and audit trails. In a skill that invokes local commands, normalizing CLI secret input increases the risk of credential leakage to other users or monitoring systems on the host.
The skill metadata claims to use NanoBananaPro, but the code actually sends prompts and images to a Gemini 3 Pro image endpoint through a third-party proxy. This mismatch can mislead users and operators about where sensitive image data and prompts are processed, undermining informed consent, data handling expectations, and security review assumptions.
The script transmits user prompts, API credentials, and optionally base64-encoded local images to an external service at apiyi.com. In an image-editing skill, this is expected functionality, but it is still security-relevant because local files may contain sensitive content and the skill description emphasizes domestic proxy access rather than clearly foregrounding third-party data exfiltration risk.
const apiKey = getApiKey(args.apiKey);
const url =
'https://api.apiyi.com/v1beta/models/gemini-3-pro-image-preview:generateContent';
const headers = {
Authorization: `Bearer ${apiKey}`,
The script transmits user prompts and, in edit mode, locally supplied images to a third-party remote service, but it provides no explicit privacy warning or consent checkpoint at the point of use. In a skill context, this can cause users to unknowingly send sensitive images or confidential text off-host to an external provider/proxy.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
api_key = get_api_key(api_key)
url = (
"https://api.apiyi.com/v1beta/models/gemini-3-pro-image-preview:generateContent"
)
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
The script sends user-supplied prompt text and optional input images to an external HTTPS endpoint for processing. This is core functionality, but in security terms it is still an external data transmission path that may expose sensitive user content to a third-party service, especially because the service is described as a domestic proxy for another model provider.
print(f"输出请求参数: {json.dumps(payload_log, indent=2, ensure_ascii=False)}")
print(f"image generation in progress...")
try:
response = requests.post(url, headers=headers, json=payload, timeout=400)
response.raise_for_status()
data = response.json()
The trigger list includes broad phrases such as '生成图片', '图片生成', and 'image generation', which can match many ordinary requests and cause the skill to activate when the user did not specifically intend to use this provider-backed image tool. Because the skill requires an API-backed external service, unintended invocation can lead to unnecessary external data transfer, accidental use of configured credentials, and confusion about which tool is operating.
At L027 the guidance says output filenames '需包含文件随机标识,避免重复' and implies uniqueness via randomness. However, L150 describes automatic naming as only a timestamp-based PNG filename. This is a direct documentation inconsistency about how filename uniqueness is ensured.
This markdown file contains only Chinese-language instructions and examples, with no note that the skill supports other languages or that Chinese is an intentional locale constraint. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation.
文件顶部说明将该脚本描述为“基于NanoBananaPro/Gemini 3 Pro”,而帮助文本在 L060 单独宣称是“基于Gemini 3 Pro的图片生成与编辑工具”。同时代码实际调用的也是 gemini-3-pro-image-preview 接口,这与技能清单强调的 NanoBananaPro 模型表述形成明显不一致,属于文档层面的意图漂移。
The natural-language instructions and argument descriptions in the module docstring are entirely Chinese, and no alternative language or opt-in is offered. Under the stated policy, forcing a specific language without user choice can be a locale-policy violation unless clearly justified as region-specific.
The manifest description is written entirely in Chinese and does not indicate any language choice or opt-in for users. This can create a language/locale policy concern if the skill is presented in multilingual contexts without making the language expectation explicit.