The following issues were found

selfdrive/ui/qt/maps/set_destination.py
5 issues
Unable to import 'common.params'
Error

Line: 5 Column: 1

              import json
import sys

from common.params import Params

if __name__ == "__main__":
  coords = sys.argv[1].split("/@")[-1].split("/")[0].split(",")
  dest = {"latitude": float(coords[0]), "longitude": float(coords[1])}
  Params().put("NavDestination", json.dumps(dest))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3
import json
import sys

from common.params import Params

if __name__ == "__main__":
  coords = sys.argv[1].split("/@")[-1].split("/")[0].split(",")
  dest = {"latitude": float(coords[0]), "longitude": float(coords[1])}

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 8 Column: 1

              from common.params import Params

if __name__ == "__main__":
  coords = sys.argv[1].split("/@")[-1].split("/")[0].split(",")
  dest = {"latitude": float(coords[0]), "longitude": float(coords[1])}
  Params().put("NavDestination", json.dumps(dest))

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 9 Column: 1

              
if __name__ == "__main__":
  coords = sys.argv[1].split("/@")[-1].split("/")[0].split(",")
  dest = {"latitude": float(coords[0]), "longitude": float(coords[1])}
  Params().put("NavDestination", json.dumps(dest))

            

Reported by Pylint.

Bad indentation. Found 2 spaces, expected 4
Style

Line: 10 Column: 1

              if __name__ == "__main__":
  coords = sys.argv[1].split("/@")[-1].split("/")[0].split(",")
  dest = {"latitude": float(coords[0]), "longitude": float(coords[1])}
  Params().put("NavDestination", json.dumps(dest))

            

Reported by Pylint.

selfdrive/car/volkswagen/carstate.py
5 issues
No name 'car' in module 'cereal'
Error

Line: 2 Column: 1

              import numpy as np
from cereal import car
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.volkswagen.values import DBC_FILES, CANBUS, NetworkLocation, TransmissionType, GearShifter, BUTTON_STATES, CarControllerParams

class CarState(CarStateBase):

            

Reported by Pylint.

Unable to import 'opendbc.can.parser'
Error

Line: 5 Column: 1

              from cereal import car
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.volkswagen.values import DBC_FILES, CANBUS, NetworkLocation, TransmissionType, GearShifter, BUTTON_STATES, CarControllerParams

class CarState(CarStateBase):
  def __init__(self, CP):

            

Reported by Pylint.

No name 'can' in module 'opendbc'
Error

Line: 5 Column: 1

              from cereal import car
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.volkswagen.values import DBC_FILES, CANBUS, NetworkLocation, TransmissionType, GearShifter, BUTTON_STATES, CarControllerParams

class CarState(CarStateBase):
  def __init__(self, CP):

            

Reported by Pylint.

Unable to import 'opendbc.can.can_define'
Error

Line: 6 Column: 1

              from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.volkswagen.values import DBC_FILES, CANBUS, NetworkLocation, TransmissionType, GearShifter, BUTTON_STATES, CarControllerParams

class CarState(CarStateBase):
  def __init__(self, CP):
    super().__init__(CP)

            

Reported by Pylint.

No name 'can' in module 'opendbc'
Error

Line: 6 Column: 1

              from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.car.volkswagen.values import DBC_FILES, CANBUS, NetworkLocation, TransmissionType, GearShifter, BUTTON_STATES, CarControllerParams

class CarState(CarStateBase):
  def __init__(self, CP):
    super().__init__(CP)

            

Reported by Pylint.

selfdrive/test/openpilotci.py
5 issues
Unable to import 'azure.storage.blob'
Error

Line: 15 Column: 3

                return BASE_URL + "%s/%s/%s.%s" % (route_name.replace("|", "/"), segment_num, log_type, ext)

def upload_file(path, name):
  from azure.storage.blob import BlockBlobService

  sas_token = None
  if os.path.isfile(TOKEN_PATH):
    sas_token = open(TOKEN_PATH).read().strip()


            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 4
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              #!/usr/bin/env python3
import os
import sys
import subprocess

BASE_URL = "https://commadataci.blob.core.windows.net/openpilotci/"

TOKEN_PATH = "/data/azure_token"


            

Reported by Bandit.

Possible hardcoded password: '/data/azure_token'
Security

Line: 8
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html

              
BASE_URL = "https://commadataci.blob.core.windows.net/openpilotci/"

TOKEN_PATH = "/data/azure_token"

def get_url(route_name, segment_num, log_type="rlog"):
  ext = "hevc" if log_type in ["fcamera", "dcamera"] else "bz2"
  return BASE_URL + "%s/%s/%s.%s" % (route_name.replace("|", "/"), segment_num, log_type, ext)


            

Reported by Bandit.

Starting a process with a partial executable path
Security injection

Line: 22
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html

                  sas_token = open(TOKEN_PATH).read().strip()

  if sas_token is None:
    sas_token = subprocess.check_output("az storage container generate-sas --account-name commadataci --name openpilotci --https-only --permissions lrw \
                                         --expiry $(date -u '+%Y-%m-%dT%H:%M:%SZ' -d '+1 hour') --auth-mode login --as-user --output tsv", shell=True).decode().strip("\n")
  service = BlockBlobService(account_name="commadataci", sas_token=sas_token)
  service.create_blob_from_path("openpilotci", name, path)
  return "https://commadataci.blob.core.windows.net/openpilotci/" + name


            

Reported by Bandit.

subprocess call with shell=True seems safe, but may be changed in the future, consider rewriting without shell
Security injection

Line: 23
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

              
  if sas_token is None:
    sas_token = subprocess.check_output("az storage container generate-sas --account-name commadataci --name openpilotci --https-only --permissions lrw \
                                         --expiry $(date -u '+%Y-%m-%dT%H:%M:%SZ' -d '+1 hour') --auth-mode login --as-user --output tsv", shell=True).decode().strip("\n")
  service = BlockBlobService(account_name="commadataci", sas_token=sas_token)
  service.create_blob_from_path("openpilotci", name, path)
  return "https://commadataci.blob.core.windows.net/openpilotci/" + name

if __name__ == "__main__":

            

Reported by Bandit.

selfdrive/car/chrysler/carstate.py
5 issues
No name 'car' in module 'cereal'
Error

Line: 1 Column: 1

              from cereal import car
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD


class CarState(CarStateBase):

            

Reported by Pylint.

No name 'can' in module 'opendbc'
Error

Line: 2 Column: 1

              from cereal import car
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD


class CarState(CarStateBase):

            

Reported by Pylint.

Unable to import 'opendbc.can.parser'
Error

Line: 2 Column: 1

              from cereal import car
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD


class CarState(CarStateBase):

            

Reported by Pylint.

Unable to import 'opendbc.can.can_define'
Error

Line: 3 Column: 1

              from cereal import car
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD


class CarState(CarStateBase):

            

Reported by Pylint.

No name 'can' in module 'opendbc'
Error

Line: 3 Column: 1

              from cereal import car
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD


class CarState(CarStateBase):

            

Reported by Pylint.

selfdrive/modeld/visiontest.py
5 issues
Consider possible security implications associated with subprocess module.
Security blacklist

Line: 2
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import os
import subprocess
from cffi import FFI
from common.basedir import BASEDIR

# Initialize visiontest. Ignore output.
_visiond_dir = os.path.dirname(os.path.abspath(__file__))
_libvisiontest = "libvisiontest.so"
try:  # because this crashes sometimes when running pipeline

            

Reported by Bandit.

Starting a process with a partial executable path
Security injection

Line: 10
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b607_start_process_with_partial_path.html

              _visiond_dir = os.path.dirname(os.path.abspath(__file__))
_libvisiontest = "libvisiontest.so"
try:  # because this crashes sometimes when running pipeline
  subprocess.check_output(["make", "-C", _visiond_dir, "-f",
                           os.path.join(_visiond_dir, "visiontest.mk"),
                           _libvisiontest])
except Exception:
  pass


            

Reported by Bandit.

subprocess call - check for execution of untrusted input.
Security injection

Line: 10
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

              _visiond_dir = os.path.dirname(os.path.abspath(__file__))
_libvisiontest = "libvisiontest.so"
try:  # because this crashes sometimes when running pipeline
  subprocess.check_output(["make", "-C", _visiond_dir, "-f",
                           os.path.join(_visiond_dir, "visiontest.mk"),
                           _libvisiontest])
except Exception:
  pass


            

Reported by Bandit.

Try, Except, Pass detected.
Security

Line: 13
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b110_try_except_pass.html

                subprocess.check_output(["make", "-C", _visiond_dir, "-f",
                           os.path.join(_visiond_dir, "visiontest.mk"),
                           _libvisiontest])
except Exception:
  pass


class VisionTest():
  """A version of the vision model that can be run on a desktop.

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 109
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
  def transform_output_buffer(self, yuv_data, y_out, u_out, v_out,
                              transform):
    assert len(yuv_data) == self.input_size[0] * self.input_size[1] * 3 / 2

    cast = self.ffi.cast
    from_buffer = self.ffi.from_buffer
    yuv_ptr = cast("unsigned char*", from_buffer(yuv_data))
    transform_ptr = self.ffi.new("float[]", transform)

            

Reported by Bandit.

selfdrive/test/test_valgrind_replay.py
5 issues
subprocess call with shell=True identified, security issue.
Security injection

Line: 55
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

                  os.chdir(os.path.join(BASEDIR, cwd))
    # Run valgrind on a process
    command = "valgrind --leak-check=full " + arg
    p = subprocess.Popen(command, stderr=subprocess.PIPE, shell=True, preexec_fn=os.setsid)  # pylint: disable=W1509
    while not self.done:
      time.sleep(0.1)

    os.killpg(os.getpgid(p.pid), signal.SIGINT)
    _, err = p.communicate()

            

Reported by Bandit.

Unable to import 'tqdm'
Error

Line: 12 Column: 3

                def tqdm(x):
    return x
else:
  from tqdm import tqdm   # type: ignore

import cereal.messaging as messaging
from collections import namedtuple
from tools.lib.logreader import LogReader
from selfdrive.test.openpilotci import get_url

            

Reported by Pylint.

Unable to import 'cereal.messaging'
Error

Line: 14 Column: 1

              else:
  from tqdm import tqdm   # type: ignore

import cereal.messaging as messaging
from collections import namedtuple
from tools.lib.logreader import LogReader
from selfdrive.test.openpilotci import get_url
from common.basedir import BASEDIR


            

Reported by Pylint.

No name 'messaging' in module 'cereal'
Error

Line: 14 Column: 1

              else:
  from tqdm import tqdm   # type: ignore

import cereal.messaging as messaging
from collections import namedtuple
from tools.lib.logreader import LogReader
from selfdrive.test.openpilotci import get_url
from common.basedir import BASEDIR


            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 5
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import threading
import time
import unittest
import subprocess
import signal

if "CI" in os.environ:
  def tqdm(x):
    return x

            

Reported by Bandit.

selfdrive/manager/manager.py
5 issues
No name 'messaging' in module 'cereal'
Error

Line: 9 Column: 1

              import sys
import traceback

import cereal.messaging as messaging
import selfdrive.crash as crash
from common.basedir import BASEDIR
from common.params import Params, ParamKeyType
from common.text_window import TextWindow
from selfdrive.boardd.set_time import set_time

            

Reported by Pylint.

Unable to import 'cereal.messaging'
Error

Line: 9 Column: 1

              import sys
import traceback

import cereal.messaging as messaging
import selfdrive.crash as crash
from common.basedir import BASEDIR
from common.params import Params, ParamKeyType
from common.text_window import TextWindow
from selfdrive.boardd.set_time import set_time

            

Reported by Pylint.

Probable insecure usage of temp file/directory.
Security

Line: 62
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b108_hardcoded_tmp_directory.html

              
  # Create folders needed for msgq
  try:
    os.mkdir("/dev/shm")
  except FileExistsError:
    pass
  except PermissionError:
    print("WARNING: failed to make /dev/shm")


            

Reported by Bandit.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 5
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import datetime
import os
import signal
import subprocess
import sys
import traceback

import cereal.messaging as messaging
import selfdrive.crash as crash

            

Reported by Bandit.

subprocess call - check for execution of untrusted input.
Security injection

Line: 115
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

                cloudlog.info({"environ": os.environ})

  # save boot log
  subprocess.call("./bootlog", cwd=os.path.join(BASEDIR, "selfdrive/loggerd"))

  params = Params()

  ignore = []
  if params.get("DongleId", encoding='utf8') == UNREGISTERED_DONGLE_ID:

            

Reported by Bandit.

selfdrive/boardd/tests/replay_many.py
5 issues
Unable to import 'usb1'
Error

Line: 7 Column: 1

              import time
import signal
import traceback
import usb1
from panda import Panda, PandaDFU
from multiprocessing import Pool

jungle = "JUNGLE" in os.environ
if jungle:

            

Reported by Pylint.

No name 'Panda' in module 'panda'
Error

Line: 8 Column: 1

              import signal
import traceback
import usb1
from panda import Panda, PandaDFU
from multiprocessing import Pool

jungle = "JUNGLE" in os.environ
if jungle:
  from panda_jungle import PandaJungle  # pylint: disable=import-error

            

Reported by Pylint.

No name 'PandaDFU' in module 'panda'
Error

Line: 8 Column: 1

              import signal
import traceback
import usb1
from panda import Panda, PandaDFU
from multiprocessing import Pool

jungle = "JUNGLE" in os.environ
if jungle:
  from panda_jungle import PandaJungle  # pylint: disable=import-error

            

Reported by Pylint.

No name 'messaging' in module 'cereal'
Error

Line: 15 Column: 1

              if jungle:
  from panda_jungle import PandaJungle  # pylint: disable=import-error

import cereal.messaging as messaging
from selfdrive.boardd.boardd import can_capnp_to_can_list

def initializer():
  """Ignore CTRL+C in the worker process.
  source: https://stackoverflow.com/a/44869451 """

            

Reported by Pylint.

Unable to import 'cereal.messaging'
Error

Line: 15 Column: 1

              if jungle:
  from panda_jungle import PandaJungle  # pylint: disable=import-error

import cereal.messaging as messaging
from selfdrive.boardd.boardd import can_capnp_to_can_list

def initializer():
  """Ignore CTRL+C in the worker process.
  source: https://stackoverflow.com/a/44869451 """

            

Reported by Pylint.

selfdrive/test/profiling/lib.py
5 issues
No name 'services' in module 'cereal'
Error

Line: 2 Column: 1

              from collections import defaultdict, deque
from cereal.services import service_list
import cereal.messaging as messaging
import capnp


class ReplayDone(Exception):
  pass


            

Reported by Pylint.

Unable to import 'cereal.services'
Error

Line: 2 Column: 1

              from collections import defaultdict, deque
from cereal.services import service_list
import cereal.messaging as messaging
import capnp


class ReplayDone(Exception):
  pass


            

Reported by Pylint.

Unable to import 'cereal.messaging'
Error

Line: 3 Column: 1

              from collections import defaultdict, deque
from cereal.services import service_list
import cereal.messaging as messaging
import capnp


class ReplayDone(Exception):
  pass


            

Reported by Pylint.

No name 'messaging' in module 'cereal'
Error

Line: 3 Column: 1

              from collections import defaultdict, deque
from cereal.services import service_list
import cereal.messaging as messaging
import capnp


class ReplayDone(Exception):
  pass


            

Reported by Pylint.

Unable to import 'capnp'
Error

Line: 4 Column: 1

              from collections import defaultdict, deque
from cereal.services import service_list
import cereal.messaging as messaging
import capnp


class ReplayDone(Exception):
  pass


            

Reported by Pylint.

selfdrive/car/toyota/carstate.py
5 issues
No name 'car' in module 'cereal'
Error

Line: 1 Column: 1

              from cereal import car
from common.numpy_fast import mean
from opendbc.can.can_define import CANDefine
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from selfdrive.config import Conversions as CV
from selfdrive.car.toyota.values import CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, TSS2_CAR



            

Reported by Pylint.

No name 'can' in module 'opendbc'
Error

Line: 3 Column: 1

              from cereal import car
from common.numpy_fast import mean
from opendbc.can.can_define import CANDefine
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from selfdrive.config import Conversions as CV
from selfdrive.car.toyota.values import CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, TSS2_CAR



            

Reported by Pylint.

Unable to import 'opendbc.can.can_define'
Error

Line: 3 Column: 1

              from cereal import car
from common.numpy_fast import mean
from opendbc.can.can_define import CANDefine
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from selfdrive.config import Conversions as CV
from selfdrive.car.toyota.values import CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, TSS2_CAR



            

Reported by Pylint.

No name 'can' in module 'opendbc'
Error

Line: 5 Column: 1

              from common.numpy_fast import mean
from opendbc.can.can_define import CANDefine
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from selfdrive.config import Conversions as CV
from selfdrive.car.toyota.values import CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, TSS2_CAR


class CarState(CarStateBase):

            

Reported by Pylint.

Unable to import 'opendbc.can.parser'
Error

Line: 5 Column: 1

              from common.numpy_fast import mean
from opendbc.can.can_define import CANDefine
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from selfdrive.config import Conversions as CV
from selfdrive.car.toyota.values import CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, TSS2_CAR


class CarState(CarStateBase):

            

Reported by Pylint.