minimind/trainer
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
..
rollout_engine.py [fix] bugs 2026-04-21 13:03:34 +08:00
train_agent.py fix: replace dangerous expression evaluation with AST-validated safe math parser (CWE-95) 2026-04-23 19:36:39 +01:00
train_distillation.py [fix] bugs 2026-04-21 13:03:34 +08:00
train_dpo.py [fix] bugs 2026-04-21 13:03:34 +08:00
train_full_sft.py [fix] bugs 2026-04-21 13:03:34 +08:00
train_grpo.py [fix] bugs 2026-04-21 13:03:34 +08:00
train_lora.py [fix] bugs 2026-04-21 13:03:34 +08:00
train_ppo.py [fix] bugs 2026-04-21 13:03:34 +08:00
train_pretrain.py [fix] bugs 2026-04-21 13:03:34 +08:00
train_tokenizer.py [update] minimind-3 2026-03-25 23:57:45 +08:00
trainer_utils.py [update] minimind-3 2026-03-25 23:57:45 +08:00