启动进程 shell,可能检测到注入,安全问题

Starting a process with a shell, possible injection detected, security issue

使用bandit 检查代码是否存在漏洞问题。

https://docs.openstack.org/bandit/1.4.0/plugins/start_process_with_a_shell.html

如何解决这个问题?除了使用 commands 库(即 commands.getoutput)还有其他选择吗?请指教

(python2.7)
此安全领域的新手,如果这些标签不合适,请更新标签。

这里说,https://github.com/openstack/bandit/blob/master/bandit/plugins/injection_shell.py#L62

commands.getoutput 易受攻击,但不建议更换!呃!

有人可以推荐一个解决方案吗?谢谢。

我找到的唯一解决方案是,使用 --no-sec 标志标记您确定为错误标志的测试。这将从强盗的检查中省略该特定测试/