T09 · Insecure Skill Coding Practices
- Location
scripts/generate_daily.py:29- Finding
External Image Generator Inherits the Entire Process Environment
- Content
View full analysis
Optional[Path]: candidates = [ Path(os.environ.get("SEEDREAM_SCRIPT", "")), Path.home() / ".openclaw" / "skills" / "di-seedream-gen" / "scripts" / "generate_image.py", Path.home() / ".openclaw" / "workspace-imagor" / "skills" / "di-seedream-gen" / "scripts" / "generate_image.py", Path.home() / ".openclaw" / "workspace" / "skills" / "di-seedream-gen" / "scripts" / "generate_image.py", ] for p in candidates: if p.exists(): return p return None ``` ```python api_key = os.environ.get("SEEDREAM_API_KEY", "") if not api_key: sys.exit(1) script = find_seedream_script() if not script: sys.exit(1) output_file = output_dir / f"{today}.png" env = os.environ.copy() env["SEEDREAM_API_KEY"] = api_key cmd = [ sys.executable, str(script), "--prompt", prompt, "--filename", str(output_file), "--size", args.size, "--model", args.model ] result = subprocess.run( cmd, env=env, capture_output=True, text=True, timeout=120 ) ``` ### Technical Analysis The script permits the `SEEDREAM_SCRIPT` environment variable to select a local Python program. It also searches several external OpenClaw Skill installation paths. The selected program is then executed as a child process. The use of an argument list rather than `shell=True` prevents conventional shell metacharacter injection. However, the child process receives `os.environ.copy()`, which forwards every environment variable accessible to the parent process. This may include unrelated secrets such as: - `DEEPSEEK_API_KEY` - `TELEGRAM_BOT_TOKEN` - Cloud-provider credentials - CI/CD access tokens - Database credentials - Other API keys sto ...[truncated 2240 chars]- Remediation
View remediation
