pw-image-generation
Audited by Socket on Sep 23, 2026
4 alerts found:
AnomalySecurityx3未发现明显的恶意载荷、代码混淆、命令执行、凭据窃取或持久化机制。代码具有明确的图像分析用途,但存在中等安全风险:远程输入可造成SSRF,下载无大小限制,且默认第三方API会接收图像和API密钥。应验证默认服务可信度,并限制允许访问的URL、响应大小、重定向和本地文件路径。
The code appears to be a legitimate image-upload utility, not malware. However, it contains a high-impact command-injection vulnerability because the user-controlled image path is embedded directly in shell commands executed by execSync. It also intentionally discloses selected local files to third-party services and exposes a hardcoded upload API key. Replace execSync string commands with execFile or spawn using argument arrays, validate regular image files and size/type, and manage provider credentials securely.
The code is a benign image-merging utility with a significant command-injection weakness. User-controlled paths and filenames flow into `child_process.exec` through insufficiently escaped shell interpolation. Use `execFile` or `spawn` with an argument array and validate paths; also consider preventing ImageMagick option injection with an appropriate argument boundary such as `--` where supported. No clear malware or data-exfiltration behavior is present.
未发现该片段本身包含恶意执行代码,但存在高优先级配置安全问题:明文 API_KEY 泄露,以及将 AI 请求导向未经验证的第三方域名。应立即撤销并轮换该密钥,改用环境变量或秘密管理系统,并在示例文件中使用占位符;同时验证该域名的所有权、TLS 配置、数据处理政策和服务端实现。