Why it matters
Whatever the model is persuaded to write, including by instructions in a document or web page it reads, runs on this host.
How to fix it
Give the agent narrow tools that do one fixed action with validated arguments. If code execution is required, run it in a disposable sandbox with no credentials or network, and require human approval.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
import subprocess
from langchain_core.tools import tool
@tool
def run_shell(command: str) -> str:
"""Run a shell command and return its output."""
return subprocess.run(command, shell=True, capture_output=True, text=True).stdoutfrom langchain_core.tools import tool
ORDERS = {"1001": "shipped"}
@tool
def order_status(order_id: str) -> str:
"""Look up the status of an order by its ID."""
return ORDERS.get(order_id, "unknown")What TrustIvan reads
Runs on repository scans of Python source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- Llm prompt injection system from request input (Python)
PythonSeverity: Medium
trustivan-python-taint-llm-prompt-injection-system - Llm unbounded output tokens (Python)
PythonSeverity: Low
trustivan-python-llm-unbounded-output-tokens - Llm output to sink from request input (Python)
PythonSeverity: High
trustivan-python-taint-llm-output-to-sink - Ai sdk use (Python)
PythonSeverity: Low
trustivan-python-ai-sdk-use - CORS wildcard credentials (Python)
PythonSeverity: High
trustivan-python-cors-wildcard-credentials - Weak RSA key (Python)
PythonSeverity: Medium
trustivan-python-weak-rsa-key
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation