baoyu-image-gen
Audited by Socket on Sep 9, 2026
3 alerts found:
SecurityAnomalyx2This module itself does not implement classic JS malware primitives (no eval/Function, no direct network calls, no credential theft logic visible in the snippet). However, it orchestrates execution of an external `codex` CLI with explicitly permissive/unsafe sandbox settings (`--sandbox danger-full-access`) and weakened safety checks (`--skip-git-repo-check`). It passes fully caller-controlled instruction content via stdin and caller-controlled `--image` arguments via the command line, then persists the child’s raw stdout/stderr to disk and parses stdout. In any threat model where `input.instruction` or environment/PATH cannot be strictly trusted, this design creates a high-impact security risk because it enables powerful behavior inside the spawned tool rather than constraining or validating inputs at this layer.
This module primarily acts as an OpenAI image client. No clear malware/backdoor behavior is present in the fragment. However, it introduces meaningful security risks typical for image-generation tooling: (1) potential arbitrary local file read/upload via `args.referenceImages` -> `readFile(refPath)` -> edits request, (2) potential SSRF/egress-control risk via `fetch(img.url)` using a URL returned by the API response, and (3) environment-controlled outbound destination (`OPENAI_BASE_URL`) which could leak the bearer token if misconfigured. If upstream code strictly validates `referenceImages` to an allowlisted directory and restricts/normalizes returned URLs (or relies on trusted vendor guarantees), overall risk would be lower; otherwise, it warrants security review and hardening.
This module appears intended for legitimate image-generation orchestration, not for malware. However, it contains meaningful security risks in common deployment scenarios: it performs unrestricted local file reads based on CLI-provided reference image paths, and it may issue outbound fetch requests to arbitrary http/https URLs found in the OpenRouter response without host allowlisting. If attackers can influence reference image paths or the response contents/URLs, the risk can rise to local file disclosure and SSRF-like network access.