[IMP] hw_*: Remove "Shell=True" in subrpocess calls

In the IoT Box, most calls to subprocess used "Shell=True", which can
cause security issues.

TaskID: 1966417
This commit is contained in:
Antoine Prieels
2019-09-04 13:10:03 +00:00
parent 70006311d0
commit 6cf30cb869
3 changed files with 3 additions and 3 deletions
@@ -64,7 +64,7 @@ class IoTboxHomepage(web.Home):
mac = get_mac()
h = iter(hex(mac)[2:].zfill(12))
ssid = helpers.get_ssid()
wired = subprocess.check_output('cat /sys/class/net/eth0/operstate', shell=True).decode('utf-8').strip('\n')
wired = subprocess.check_output(['cat', '/sys/class/net/eth0/operstate']).decode('utf-8').strip('\n')
if wired == 'up':
network = 'Ethernet'
elif ssid:
+1 -1
View File
@@ -34,7 +34,7 @@ class PosboxUpgrader(hw_proxy.Proxy):
@http.route('/hw_proxy/upgrade', type='http', auth='none', )
def upgrade(self):
commit = subprocess.check_output("git --work-tree=/home/pi/odoo/ --git-dir=/home/pi/odoo/.git log -1", shell=True).decode('utf-8').replace("\n", "<br/>")
commit = subprocess.check_output(["git", "--work-tree=/home/pi/odoo/", "--git-dir=/home/pi/odoo/.git", "log", "-1"]).decode('utf-8').replace("\n", "<br/>")
return upgrade_page_template.render({
'title': "Odoo's IoTBox - Software Upgrade",
'breadcrumb': 'IoT Box Software Upgrade',
+1 -1
View File
@@ -127,7 +127,7 @@ class Proxy(http.Controller):
%s
</pre>
""" % subprocess.check_output('lsusb -v', shell=True).decode('utf-8')
""" % subprocess.check_output(['lsusb', '-v']).decode('utf-8')
return request.make_response(resp,{
'Cache-Control': 'no-cache',