Skip to content

Secure formula evaluation#153

Merged
alexanderthclark merged 2 commits intomainfrom
codex/rewrite-_safe_eval-to-use-ast-or-sympy
Jul 13, 2025
Merged

Secure formula evaluation#153
alexanderthclark merged 2 commits intomainfrom
codex/rewrite-_safe_eval-to-use-ast-or-sympy

Conversation

@alexanderthclark
Copy link
Owner

Summary

  • replace risky eval() usage in formula parsing with AST-based evaluator

Testing

  • pre-commit run --files freeride/formula.py tests/test_formula.py
  • pytest -q

https://chatgpt.com/codex/tasks/task_e_6872bf952bc883279b893eca47b896af

- Extract _eval_ast_node as a module-level function for better testability
- Simplify _safe_eval by removing nested function definition
- Improve code readability and maintainability
- Preserve all security benefits of AST-based evaluation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@alexanderthclark alexanderthclark merged commit 09b16f9 into main Jul 13, 2025
3 of 6 checks passed
@alexanderthclark alexanderthclark deleted the codex/rewrite-_safe_eval-to-use-ast-or-sympy branch July 13, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant