I am getting below warning while running my python code through Semgrep(Static Code validater). Please suggest any practical example how to use a whitelist to prevent running untrusted code or any other solution to avoid this warning.I searched on net but could not found any example..
I am getting warning at below particuklar line with import_module
Warning: Untrusted user input in importlib.import_module() function allows an attacker to load arbitrary code.Avoid dynamic values in importlib.import_module() or use a whitelist to prevent running untrusted code.
channel_module = import_module("src.main.core_prj.prj_" + config['subscription'].lower())