fix(api): Code scanning alerts (#254)

This commit is contained in:
pycook
2023-11-06 14:27:30 +08:00
committed by GitHub
parent 46238b8b51
commit 2ae4aeee67
3 changed files with 10 additions and 7 deletions

View File

@@ -81,8 +81,9 @@ class AttributeManager(object):
elif choice_other.get('script'):
try:
x = compile(choice_other['script'], '', "exec")
exec(x)
res = locals()['ChoiceValue']().values() or []
local_ns = {}
exec(x, {}, local_ns)
res = local_ns['ChoiceValue']().values() or []
return [[i, {}] for i in res]
except Exception as e:
current_app.logger.error("get choice values from script: {}".format(e))