From 3ea8e5ad729c287453d8da1956b18ca98e01032c Mon Sep 17 00:00:00 2001 From: frikky Date: Sat, 4 Sep 2021 22:22:44 +0200 Subject: [PATCH] Re-fixed new, faster Liquidpy to run in wild mode (arbitrary code exec) --- backend/app_sdk/app_base.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index ed59e344..1c659309 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -1559,7 +1559,7 @@ class AppBase: #print(globals()) print("Running liquid with data of length %d" % len(template)) - run = Liquid(template, {'mode': 'wild'}) + run = Liquid(template, mode="wild", from_file=False) # Can't handle self yet (?) ret = run.render(**globals()) @@ -1573,14 +1573,12 @@ class AppBase: # return ret #except liquid.exceptions.LiquidRenderError as e: # print("Render error: %s" % e) - - except liquid.exceptions.LiquidRenderError as e: - print("Render error: %s" % e) - except liquid.exceptions.LiquidSyntaxError as e: - print("Syntax error: %s" % e) + except jinja2.exceptions.TemplateNotFound as e: + print("[ERROR] Template error: %s" % e) + except jinja2.exceptions.TemplateSyntaxError as e: + print("[ERROR] Syntax error: %s" % e) except: - print("General exception for liquid") - pass + print("[ERROR] General exception for liquid") return template