T09 · Insecure Skill Coding Practices
- Location
generate.py:84- Finding
Reference images and sensitive URLs are exposed through console logging
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does what it claims, but it unnecessarily exposes reference image data in logs and accepts unvalidated download URLs from the API.
Review before installing. Avoid passing private local images, data URLs, or signed URLs until logging is fixed, because those values may be retained in transcripts or logs. Use a limited API key and run in a network-contained environment if you do not fully trust API-returned download URLs.
generate.py:84Reference images and sensitive URLs are exposed through console logging
generate.py:147Unvalidated API-controlled image URL permits server-side request forgery
The declared purpose says the skill generates images from text prompts, but the documented behavior also includes reading local files, accepting arbitrary URLs/data URLs, and writing output files. This mismatch is dangerous because users and policy systems may underestimate the skill's ability to access local content or interact with untrusted remote resources, which can enable data exposure, SSRF-like fetches, or unintended file handling.
The skill documentation describes use of environment-derived API credentials and outbound network access, but it does not declare any tool scope or permission boundaries. This is dangerous because an agent may grant broader-than-necessary capabilities implicitly, making credential access and external data exfiltration harder to review or constrain.
The skill description claims text-to-image generation, but the implementation also supports image-to-image workflows by accepting reference images and converting local files into data URLs for upload. This mismatch expands the data-handling surface beyond what users would reasonably expect, increasing the risk of unintentionally sending sensitive local image content to a remote service.
The helper reads arbitrary local files identified as image paths, base64-encodes them, and sends their contents to a remote API as data URLs. In the context of an agent skill, this can lead to unintentional exfiltration of local sensitive files if a user or upstream agent passes a path without understanding that the file contents will leave the system.
Inline comments, the argparse description, and the --image-prompt help text all state that image-to-image prompting is supported. In practice, image_prompt is only printed and never added to the API payload or otherwise used to affect generation, so the documentation actively overstates what the code does.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
print(f" 端点: {api_base}")
try:
response = requests.post(api_base, json=payload, headers=headers, timeout=120, stream=True)
image_url = None
This markdown file contains substantial user-facing content in both Chinese and English, including headings, parameter descriptions, and examples, but does not state any language-selection behavior or let the user opt into a preferred language. Under the policy rule for language or locale constraints, user-facing language assumptions should be explicit or optional rather than imposed implicitly.
The code unconditionally reconfigures stdout and stderr to UTF-8. This enforces a specific encoding choice regardless of the user's locale or terminal preferences, which matches the language/locale policy concern for forced settings without opt-in.
The code accesses an API credential and sends it in an Authorization header for external network calls. While this is functionally expected for an API client, the file lacks any explanatory comment or user-facing warning about reading the key from GRSAI_API_KEY or passing secrets on the command line.