T09 · Insecure Skill Coding Practices
- Location
scripts/generate-image.js:13- Finding
Unvalidated Provider-Supplied Image URL Enables SSRF and Unbounded Response Buffering
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly coherent for image generation, but it needs Review because it stores full prompts/logs and can fetch unvalidated provider-supplied image URLs.
Install only if you trust the configured image provider and are comfortable with prompts and generator logs being saved locally. Avoid putting secrets or sensitive business data in prompts, review or clean the generated run directories, and prefer providers that return bounded inline image data until URL validation and log-retention controls are added.
scripts/generate-image.js:13Unvalidated Provider-Supplied Image URL Enables SSRF and Unbounded Response Buffering
The documented behavior does not match the detected capabilities and likely implementation: it omits sensitive actions like reading local configuration/environment for credentials and writing files, while also overstating safeguards such as retries and bounded batch concurrency. This mismatch is dangerous because users may approve or invoke the skill under false assumptions, leading to credential exposure, unexpected local side effects, or unsafe operational behavior when reliability controls are absent.
The skill advertises executable behavior that includes shell, network, filesystem, and environment/config access, but it does not declare any explicit tool scope such as permissions or allowed-tools. This creates a trust and containment problem: callers and policy systems cannot accurately understand or restrict what the skill may access, increasing the chance of unintended data exposure or misuse of local resources.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
(task_dir / 'batch_task.json').write_text(json.dumps(meta, ensure_ascii=False, indent=2), encoding='utf-8')
try:
proc = subprocess.run(
cmd,
cwd=str(WORKSPACE),
text=True,
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
(task_dir / 'batch_task.json').write_text(json.dumps(meta, ensure_ascii=False, indent=2), encoding='utf-8')
try:
proc = subprocess.run(
cmd,
cwd=str(WORKSPACE),
text=True,
The script writes the full prompt and generation parameters to request.json under a persistent directory in the user's home folder. Prompts often contain sensitive business data, personal information, or secrets, so silent persistence increases the risk of local disclosure through backups, shared machines, other local users, or later exfiltration by unrelated software.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
(attempt_dir/'request.json').write_text(json.dumps({'prompt': args.prompt, 'task_name': attempt_name, 'provider': args.provider, 'model': args.model, 'size': args.size, 'timeout_ms': args.timeout_ms, 'output': str(output)}, ensure_ascii=False, indent=2), encoding='utf-8')
started=time.time()
try:
proc=subprocess.run(cmd, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=args.timeout_ms/1000+90)
stdout=proc.stdout or ''; stderr=proc.stderr or ''
try: data=json.loads(stdout.strip())
except Exception: data={'ok':False,'stage':'wrapper_parse','returncode':proc.returncode,'stdout':stdout[-4000:],'stderr':stderr[-4000:],'diagnosis':{'category':'wrapper_error','human_reason':'Generator did not return parseable JSON.','retryable':True}}
Persisting full stdout and stderr from the generator can capture sensitive provider responses, error traces, request identifiers, prompts, or even secrets if downstream tooling logs them. Because these logs are written automatically to a durable run directory, the skill expands the blast radius of any accidental secret disclosure or sensitive content returned by the subprocess.
The inline comment says the public skill is generation-only and delivery should be handled by other tools, yet the code continues to accept and persist delivery-oriented fields such as send_to_feishu and to_open_id in task/default processing and metadata. This is not merely incomplete documentation; the comment suggests delivery concerns are excluded while the implementation still carries them through.
The timeout result includes a human-facing diagnostic string in Chinese ('批量任务外层等待超时。') with no option for locale selection or indication that the skill is region-specific. This creates a natural-language locale policy issue because users may receive forced non-default language output without prior opt-in.
The batch runner persistently stores full prompts, command metadata, stdout/stderr, and per-task results under a predictable workspace hierarchy. In an agent setting, prompts and model outputs may contain sensitive business data, personal data, secrets, or copyrighted material, so broad on-disk retention increases exposure if the workspace is shared, synced, or later accessed by other tools/users.