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

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

View File

@@ -36,9 +36,10 @@ def parse_plugin_script(script):
attributes = []
try:
x = compile(script, '', "exec")
exec(x)
unique_key = locals()['AutoDiscovery']().unique_key
attrs = locals()['AutoDiscovery']().attributes() or []
local_ns = {}
exec(x, {}, local_ns)
unique_key = local_ns['AutoDiscovery']().unique_key
attrs = local_ns['AutoDiscovery']().attributes() or []
except Exception as e:
return abort(400, str(e))