T09 · Insecure Skill Coding Practices
- Location
scripts/generate_image.py:185- 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 says, but it needs review because its credential handling can expose an API key and it sends prompt content to a third-party image API.
Review before installing. Use an environment variable or protected config for APIYI_API_KEY instead of --api-key, avoid --debug-key, do not put secrets or sensitive material in image prompts, and assume prompts plus generation settings will be sent to APIYI.
scripts/generate_image.py:185API Key Exposure Through Command-Line Arguments
scripts/generate_image.py:242Partial API Key Disclosure in Debug Output
The skill invokes a Python script and requires an API key, implying code execution, environment access, and outbound network use, yet it does not declare any explicit tool scope or allowed-tools boundary. This weakens least-privilege enforcement and makes it harder for a host agent or reviewer to understand and constrain what the skill may access.
The skill description and workflow do not clearly warn users that their prompts and related content will be transmitted to a third-party image-generation API. This creates a privacy and consent issue, especially if users include sensitive personal, business, or copyrighted material in their prompts.
The trigger guidance is broad enough to activate on common requests like 'generate an image' without clear narrowing conditions or consent checks. In practice, that can cause routine user content to be sent to an external service unexpectedly, increasing privacy and data-handling risk.
The skill mandates a Chinese-first prompt-selection workflow before generation, regardless of user preference. While not directly enabling code execution or data exfiltration beyond the API use already present, it overrides user intent and may transform user content in ways they did not request, creating avoidable consent and UX risk.
The instruction to always use English prompts forces translation or reformulation of user content without opt-in. This can alter meaning, introduce prompt drift, and send transformed content externally in a form the user did not approve, increasing consent and integrity concerns.
The hardcoded APIYI endpoint establishes a fixed external destination for all prompt and credential transmission. While not inherently malicious, a hardcoded third-party endpoint increases trust dependency on that provider and removes opportunities for administrators to redirect or constrain outbound traffic in sensitive environments.
) -> str:
"""Generate image via APIYI API."""
url = "https://api.apiyi.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent"
headers = {
"Authorization": f"Bearer {api_key}",
The script transmits user-supplied prompts and an authorization bearer token to an external third-party service. In an agent-skill context, this is a real data egress boundary: sensitive user content entered into prompts may leave the local environment, and the API key is exposed to that remote provider for authentication. This is expected for an image-generation skill, but it remains a genuine privacy and supply-chain risk if users are not clearly informed.
print(f"Generating image with prompt: {prompt[:100]}...", file=sys.stderr)
print(f"Aspect ratio: {aspect_ratio}, Size: {size}", file=sys.stderr)
response = requests.post(
url,
headers=headers,
json=payload,
The script defines suggestion features exclusively in Chinese, including function names, help text describing Chinese-only behavior, and hardcoded Chinese prompt content. This imposes a specific language/locale behavior without offering user opt-in or an alternative language path, which matches the policy's language-choice concern.
The skill's stated purpose is generating images from text descriptions, with prompt restructuring support. While calling the remote image API is expected, the additional capability to inspect the user's home-directory config file and OS environment for secrets is not justified by that narrow purpose as described in the manifest.