dspy
Audited by Socket on Sep 2, 2026
2 alerts found:
Securityx2This fragment is primarily LLM orchestration example code (RAG/classification/multi-step reasoning), with the primary security issue being a ReAct-exposed tool that uses Python eval() on untrusted tool input. While there are no clear indicators of credential theft or explicit exfiltration in the snippet, the eval usage creates an arbitrary code execution risk if an attacker can influence—or the model can cause—the expression passed to calculate().
The provided module contains a critical security weakness: an agent-registered tool (`calculate`) uses unrestricted `eval(expr)` on an unvalidated string that can be influenced by the agent’s tool-calling behavior. While there is no direct evidence of exfiltration or stealthy malware in the snippet itself, the eval sink makes this code a strong target for malicious exploitation in an agent setting. If used, `eval` should be replaced with a safe expression parser/allowlist and the tool should be tightly constrained to numeric arithmetic.