提交 97904054 编写于 作者: A Amador Pahim 提交者: Lukáš Doktor

sysinfo: Don't use shell in sysinfo collection

The use of shell in subprocess should not be needed and might bring some
security issues. Let's disable it.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
Signed-off-by: NAmador Pahim <apahim@redhat.com>
上级 e2d8d8b9
......@@ -16,6 +16,7 @@ import gzip
import json
import logging
import os
import shlex
import shutil
import time
import threading
......@@ -222,8 +223,8 @@ class Daemon(Command):
logf_path = os.path.join(logdir, self.logf)
stdin = open(os.devnull, "r")
stdout = open(logf_path, "w")
self.pipe = subprocess.Popen(self.cmd, stdin=stdin, stdout=stdout,
stderr=subprocess.STDOUT, shell=True, env=env)
self.pipe = subprocess.Popen(shlex.split(self.cmd), stdin=stdin, stdout=stdout,
stderr=subprocess.STDOUT, shell=False, env=env)
def stop(self):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册