The following issues were found

selfdrive/test/helpers.py
3 issues
Unable to import 'nose.tools'
Error

Line: 3 Column: 1

              import time
from functools import wraps
from nose.tools import nottest

from selfdrive.hardware import PC
from selfdrive.version import training_version, terms_version
from selfdrive.manager.process_config import managed_processes



            

Reported by Pylint.

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

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

                      managed_processes[p].start()
        if n < len(processes) - 1:
          time.sleep(init_time)
      assert all(managed_processes[name].proc.exitcode is None for name in processes)

      # call the function
      try:
        func(*args, **kwargs)
        # assert processes are still started

            

Reported by Bandit.

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

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

                    try:
        func(*args, **kwargs)
        # assert processes are still started
        assert all(managed_processes[name].proc.exitcode is None for name in processes if name not in ignore_stopped)
      finally:
        for p in processes:
          managed_processes[p].stop()

    return wrap

            

Reported by Bandit.

selfdrive/car/ford/radar_interface.py
3 issues
No name 'car' in module 'cereal'
Error

Line: 2 Column: 1

              #!/usr/bin/env python3
from cereal import car
from opendbc.can.parser import CANParser
from selfdrive.car.ford.values import DBC
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import RadarInterfaceBase

RADAR_MSGS = list(range(0x500, 0x540))


            

Reported by Pylint.

Unable to import 'opendbc.can.parser'
Error

Line: 3 Column: 1

              #!/usr/bin/env python3
from cereal import car
from opendbc.can.parser import CANParser
from selfdrive.car.ford.values import DBC
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import RadarInterfaceBase

RADAR_MSGS = list(range(0x500, 0x540))


            

Reported by Pylint.

No name 'can' in module 'opendbc'
Error

Line: 3 Column: 1

              #!/usr/bin/env python3
from cereal import car
from opendbc.can.parser import CANParser
from selfdrive.car.ford.values import DBC
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import RadarInterfaceBase

RADAR_MSGS = list(range(0x500, 0x540))


            

Reported by Pylint.

selfdrive/debug/internal/measure_torque_time_to_max.py
3 issues
No name 'log' in module 'cereal'
Error

Line: 10 Column: 1

              from collections import deque
from statistics import mean

from cereal import log
import cereal.messaging as messaging

if __name__ == "__main__":

  parser = argparse.ArgumentParser(description='Sniff a communication socket')

            

Reported by Pylint.

Unable to import 'cereal.messaging'
Error

Line: 11 Column: 1

              from statistics import mean

from cereal import log
import cereal.messaging as messaging

if __name__ == "__main__":

  parser = argparse.ArgumentParser(description='Sniff a communication socket')
  parser.add_argument('--addr', default='127.0.0.1')

            

Reported by Pylint.

No name 'messaging' in module 'cereal'
Error

Line: 11 Column: 1

              from statistics import mean

from cereal import log
import cereal.messaging as messaging

if __name__ == "__main__":

  parser = argparse.ArgumentParser(description='Sniff a communication socket')
  parser.add_argument('--addr', default='127.0.0.1')

            

Reported by Pylint.

selfdrive/debug/internal/replay_drive_can.py
3 issues
Unable to import 'tqdm'
Error

Line: 4 Column: 1

              #!/usr/bin/env python3

import time
from tqdm import tqdm
from tools.lib.logreader import LogReader
import cereal.messaging as messaging

ROUTE = "77611a1fac303767/2020-03-24--09-50-38"
NUM_SEGS = 10 # route has 82 segments available

            

Reported by Pylint.

No name 'messaging' in module 'cereal'
Error

Line: 6 Column: 1

              import time
from tqdm import tqdm
from tools.lib.logreader import LogReader
import cereal.messaging as messaging

ROUTE = "77611a1fac303767/2020-03-24--09-50-38"
NUM_SEGS = 10 # route has 82 segments available

# Get can messages from logs

            

Reported by Pylint.

Unable to import 'cereal.messaging'
Error

Line: 6 Column: 1

              import time
from tqdm import tqdm
from tools.lib.logreader import LogReader
import cereal.messaging as messaging

ROUTE = "77611a1fac303767/2020-03-24--09-50-38"
NUM_SEGS = 10 # route has 82 segments available

# Get can messages from logs

            

Reported by Pylint.

selfdrive/car/ford/carstate.py
3 issues
No name 'car' in module 'cereal'
Error

Line: 1 Column: 1

              from cereal import car
from opendbc.can.parser import CANParser
from common.numpy_fast import mean
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.ford.values import DBC

WHEEL_RADIUS = 0.33


            

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 common.numpy_fast import mean
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.ford.values import DBC

WHEEL_RADIUS = 0.33


            

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 common.numpy_fast import mean
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.ford.values import DBC

WHEEL_RADIUS = 0.33


            

Reported by Pylint.

selfdrive/car/ford/carcontroller.py
3 issues
No name 'car' in module 'cereal'
Error

Line: 2 Column: 1

              import math
from cereal import car
from selfdrive.car import make_can_msg
from selfdrive.car.ford.fordcan import create_steer_command, create_lkas_ui, spam_cancel_button
from opendbc.can.packer import CANPacker

VisualAlert = car.CarControl.HUDControl.VisualAlert

MAX_STEER_DELTA = 1

            

Reported by Pylint.

Unable to import 'opendbc.can.packer'
Error

Line: 5 Column: 1

              from cereal import car
from selfdrive.car import make_can_msg
from selfdrive.car.ford.fordcan import create_steer_command, create_lkas_ui, spam_cancel_button
from opendbc.can.packer import CANPacker

VisualAlert = car.CarControl.HUDControl.VisualAlert

MAX_STEER_DELTA = 1
TOGGLE_DEBUG = False

            

Reported by Pylint.

No name 'can' in module 'opendbc'
Error

Line: 5 Column: 1

              from cereal import car
from selfdrive.car import make_can_msg
from selfdrive.car.ford.fordcan import create_steer_command, create_lkas_ui, spam_cancel_button
from opendbc.can.packer import CANPacker

VisualAlert = car.CarControl.HUDControl.VisualAlert

MAX_STEER_DELTA = 1
TOGGLE_DEBUG = False

            

Reported by Pylint.

selfdrive/car/car_helpers.py
3 issues
No name 'messaging' in module 'cereal'
Error

Line: 9 Column: 1

              from selfdrive.car.vin import get_vin, VIN_UNKNOWN
from selfdrive.car.fw_versions import get_fw_versions, match_fw_to_car
from selfdrive.swaglog import cloudlog
import cereal.messaging as messaging
from selfdrive.car import gen_empty_fingerprint

from cereal import car
EventName = car.CarEvent.EventName


            

Reported by Pylint.

Unable to import 'cereal.messaging'
Error

Line: 9 Column: 1

              from selfdrive.car.vin import get_vin, VIN_UNKNOWN
from selfdrive.car.fw_versions import get_fw_versions, match_fw_to_car
from selfdrive.swaglog import cloudlog
import cereal.messaging as messaging
from selfdrive.car import gen_empty_fingerprint

from cereal import car
EventName = car.CarEvent.EventName


            

Reported by Pylint.

No name 'car' in module 'cereal'
Error

Line: 12 Column: 1

              import cereal.messaging as messaging
from selfdrive.car import gen_empty_fingerprint

from cereal import car
EventName = car.CarEvent.EventName


def get_startup_event(car_recognized, controller_available, fuzzy_fingerprint, fw_seen):
  if comma_remote and tested_branch:

            

Reported by Pylint.

selfdrive/hardware/tici/iwlist.py
3 issues
Consider possible security implications associated with subprocess module.
Security blacklist

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

              import subprocess


def scan(interface="wlan0"):
  result = []
  try:
    r = subprocess.check_output(["iwlist", interface, "scan"], encoding='utf8')

    mac = None

            

Reported by Bandit.

Starting a process with a partial executable path
Security injection

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

              def scan(interface="wlan0"):
  result = []
  try:
    r = subprocess.check_output(["iwlist", interface, "scan"], encoding='utf8')

    mac = None
    for line in r.split('\n'):
      if "Address" in line:
        # Based on the adapter eithere a percentage or dBm is returned

            

Reported by Bandit.

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

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

              def scan(interface="wlan0"):
  result = []
  try:
    r = subprocess.check_output(["iwlist", interface, "scan"], encoding='utf8')

    mac = None
    for line in r.split('\n'):
      if "Address" in line:
        # Based on the adapter eithere a percentage or dBm is returned

            

Reported by Bandit.

selfdrive/locationd/calibrationd.py
3 issues
No name 'messaging' in module 'cereal'
Error

Line: 12 Column: 1

              import os
import copy
import numpy as np
import cereal.messaging as messaging
from cereal import log
from selfdrive.hardware import TICI
from common.params import Params, put_nonblocking
from common.transformations.model import model_height
from common.transformations.camera import get_view_frame_from_road_frame

            

Reported by Pylint.

Unable to import 'cereal.messaging'
Error

Line: 12 Column: 1

              import os
import copy
import numpy as np
import cereal.messaging as messaging
from cereal import log
from selfdrive.hardware import TICI
from common.params import Params, put_nonblocking
from common.transformations.model import model_height
from common.transformations.camera import get_view_frame_from_road_frame

            

Reported by Pylint.

No name 'log' in module 'cereal'
Error

Line: 13 Column: 1

              import copy
import numpy as np
import cereal.messaging as messaging
from cereal import log
from selfdrive.hardware import TICI
from common.params import Params, put_nonblocking
from common.transformations.model import model_height
from common.transformations.camera import get_view_frame_from_road_frame
from common.transformations.orientation import rot_from_euler, euler_from_rot

            

Reported by Pylint.

selfdrive/locationd/models/car_kf.py
3 issues
Unable to import 'rednose.helpers.kalmanfilter'
Error

Line: 11 Column: 1

              from selfdrive.locationd.models.constants import ObservationKind
from selfdrive.swaglog import cloudlog

from rednose.helpers.kalmanfilter import KalmanFilter

if __name__ == '__main__':  # Generating sympy
  import sympy as sp
  from rednose.helpers.ekf_sym import gen_code
else:

            

Reported by Pylint.

Unable to import 'sympy'
Error

Line: 14 Column: 3

              from rednose.helpers.kalmanfilter import KalmanFilter

if __name__ == '__main__':  # Generating sympy
  import sympy as sp
  from rednose.helpers.ekf_sym import gen_code
else:
  from rednose.helpers.ekf_sym_pyx import EKF_sym  # pylint: disable=no-name-in-module, import-error



            

Reported by Pylint.

Unable to import 'rednose.helpers.ekf_sym'
Error

Line: 15 Column: 3

              
if __name__ == '__main__':  # Generating sympy
  import sympy as sp
  from rednose.helpers.ekf_sym import gen_code
else:
  from rednose.helpers.ekf_sym_pyx import EKF_sym  # pylint: disable=no-name-in-module, import-error


i = 0

            

Reported by Pylint.