Commit graph

21 commits

Author SHA1 Message Date
7c746de01c security: safe_eval can only execute code from python 3.10 2022-10-17 14:30:56 +02:00
d6ebb37253 module variable are now using the global keyword instead of a module-self object 2022-09-17 12:49:48 +02:00
423a02ce4c remade all the translation in a easier, faster and more readable way 2022-09-01 18:10:38 +02:00
92f32aec80 calling method is only enabled for constant or env function. Disabled list comprehension. Function from the env. Added a test module for safe_eval too 2022-08-20 18:08:17 +02:00
601342ab20 can't use getattr to get method 2022-08-20 11:21:05 +02:00
056088f035 deepcopy have been moved to safe_function.py and can no longer copy a function / method 2022-08-20 11:10:23 +02:00
622f43c66e safe_eval now show the template in the error traceback 2022-08-20 00:00:07 +02:00
443d16b28c MKWColor is now a dataclass to improve readability 2022-08-19 20:16:48 +02:00
b035dcb6b7 added a todo 2022-08-19 19:29:59 +02:00
265f327302 safe_eval now allow method and function 2022-08-19 19:08:50 +02:00
ec94ddece8 the code is now fully translatable 2022-08-15 23:06:23 +02:00
917f491ad1 security: safe_eval now cache depending on the env to avoid any potential issue and calling a method from an args or trying to modify it is disabled 2022-08-15 12:00:18 +02:00
8afd7e7926 safe_eval and multiple_safe_eval are now 20x faster (~2.5s -> ~0.13s) 2022-08-15 10:58:36 +02:00
89de19c723 safe_eval now cache return_lambda=True callable 2022-08-15 00:03:55 +02:00
506ee740f5 added TemplateSafeEval, TemplateMultipleSafeEval and Env type hint 2022-08-14 12:47:35 +02:00
7d15d98999 error in safe_eval now raise SafeEvalException instead of Exception 2022-08-08 18:37:12 +02:00
e4ea183c7f changed compile filename from <string> to <safe_eval> for the errors 2022-08-08 18:06:25 +02:00
cd13753960 lambda was already disabled in the la case 2022-08-08 18:03:53 +02:00
b9873a6c49 adapted safe_eval call and optimised them. MKWF safe_eval are now easier to read 2022-08-06 23:28:52 +02:00
42fef0b2e3 replaced the old safe_eval by the new safe_eval (from test, normal mode allow for ~26s -> ~13s, and with lambda mode ~26s -> ~0.03s) 2022-08-06 18:51:48 +02:00
998d1274ef started the rewrote of safe_eval to use AST (making it way easier to read and edit) and could fix some security issue.
Also allow for lambda expression to avoid recompiling and checking the expression at every call
2022-08-06 00:12:02 +02:00