tirith icon indicating copy to clipboard operation
tirith copied to clipboard

Replace Tirith final_expression parser from eval() to a safer approach

Open refeed opened this issue 1 year ago • 1 comments

Currently, the Tirith's final_expression expression is parsed by using Python's eval() function. Though we already have the eval() usage made as safe as possible, we still need to replace it with a safer approach like using a library.

An inspiration is to use: https://github.com/pyparsing/pyparsing/blob/master/examples/simpleBool.py

refeed avatar Aug 28 '24 12:08 refeed

Or at least, replace eval() with https://docs.python.org/3/library/ast.html#ast.literal_eval

for the first iteration

refeed avatar Aug 28 '24 12:08 refeed