Skip to content

Conversation

@arJ-V
Copy link

@arJ-V arJ-V commented Dec 13, 2025

  • Replace eval() usage with safe AST-based expression evaluator
  • Add _SafeEvaluator class using ast.NodeVisitor for secure parsing
  • Only allow safe AST node types and operations from _OPS dictionary
  • Maintain backward compatibility with all existing mathematical operations
  • Fixes security vulnerability while preserving functionality

Solves issue: #469

- Replace eval() usage with safe AST-based expression evaluator
- Add _SafeEvaluator class using ast.NodeVisitor for secure parsing
- Only allow safe AST node types and operations from _OPS dictionary
- Maintain backward compatibility with all existing mathematical operations
- Fixes security vulnerability while preserving functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant