SaferEval

DIRAC.Core.Utilities.SaferEval.saferEval(obj_str, max_len=2048)

This function adds an extra length check around literal_eval. On python3.11 and above (which has a recursion guard), this should be safe enough for use on general authenticated user input.

Note: This doesn’t handle all of the cases of eval, such as

datetime as those are technically executing code to instantiate the non-base objects.