T09 · Insecure Skill Coding Practices
- Location
scripts/red-team.py:109- Finding
Untrusted Prompt Content Is Passed to Tool-Capable Coding Agents Without Isolation
- Content
View full analysis
tuple[list[str], str | None]: """Build the CLI command and optional stdin for the given backend.""" combined_prompt = f"{system}\n\n---\n\n{user_msg}" if backend == "claude": return [ "claude", "--print", "--model", model, "--output-format", "text", "--no-session-persistence", "--append-system-prompt", system, user_msg, ], None elif backend == "codex": # Codex exec reads prompt from positional arg or stdin return [ "codex", "exec", "--model", model, "--quiet", combined_prompt, ], None elif backend == "gemini": # Gemini CLI: prompt as positional arg return [ "gemini", "-p", combined_prompt, ], None ``` ```python def call_agent(system: str, user_msg: str, label: str, model: str = "sonnet", backend: str = "claude") -> str: """Call a coding agent CLI with a system prompt and user message.""" print(f" ⏳ {label}...", end=" ", flush=True) t0 = time.time() cmd, stdin_data = _build_cmd(backend, system, user_msg, model) try: result = subprocess.run( cmd, capture_output=True, text=True, input=stdin_data, timeout=180, ) ``` ```python def run_debate(question: str, persona_keys: list[str], personas: dict, rounds: int, context: str, model: str, backend: str = "claude") -> str: ctx_block = f"\n\n## Additional Context\n{context}" if context else "" # . ...[truncated 5186 chars]- Remediation
View remediation
