Commit Graph

3 Commits (f105f4cf20743f3b56bfa834a391dcd477bfee40)

Author SHA1 Message Date
Sebastion d619d86c4c
fix: replace dangerous expression evaluation with AST-validated safe math parser (CWE-95)
Replace unconstrained expression evaluation in calculate_math tool
handlers with safe_eval_math(), which parses into an AST and only
allows literal numbers and basic arithmetic operators. Function calls,
attribute access, and name lookups are rejected, preventing arbitrary
code execution via prompt injection through LLM-generated tool calls.

Affected files:
- scripts/web_demo.py (Streamlit demo)
- scripts/eval_toolcall.py (tool call testing)
- trainer/train_agent.py (agent training)
2026-04-23 19:36:39 +01:00
jingyaogong 6b0b0c5e2f [update] fp16 inference 2026-03-27 16:29:46 +08:00
jingyaogong 101d7df2da [update] minimind-3 2026-03-25 23:57:45 +08:00