Advertisement
Guest User

Untitled

a guest
Jun 4th, 2017
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.83 KB | None | 0 0
  1. ============================= test session starts ==============================
  2. platform linux -- Python 3.5.3, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
  3. rootdir: /home/mak/dev/coala-bears, inifile: setup.cfg
  4. plugins: xdist-1.16.0, timeout-1.2.0, mock-1.6.0, env-0.6.0, cov-2.4.0
  5. timeout: 35.0s method: signal
  6. collected 628 items
  7.  
  8. tests/python/BanditBearTest.py ..F....
  9.  
  10. =================================== FAILURES ===================================
  11. ____________________ BanditBearTest.test_jinja2_templating _____________________
  12.  
  13. bear = <BanditBear linter object (wrapping 'bandit') at 0x7ff73c3cadd8>
  14. args = ('/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', ['import jinja2\n', 'from jinja2 imp..."/" )\n', "something = ''\n", '\n', 'Environment(loader=templateLoader, load=templateLoader, autoescape=True)\n', ...])
  15. kwargs = {}
  16. bear_output_generator = [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6828>]
  17. msg = ['Running bear BanditBear...', "Running 'bandit /home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py -f json -s B105,B106,B107,B404,B603,B606,B607'"]
  18.  
  19.  @contextmanager
  20.  def execute_bear(bear, *args, **kwargs):
  21.  try:
  22.  bear_output_generator = bear.execute(*args, **kwargs)
  23.  assert bear_output_generator is not None, \
  24.  'Bear returned None on execution\n'
  25. > yield bear_output_generator
  26.  
  27. /usr/lib/python3.5/site-packages/coalib/testing/LocalBearTestHelper.py:20:
  28. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  29.  
  30. self = <tests.python.BanditBearTest.BanditBearTest testMethod=test_jinja2_templating>
  31. local_bear = <BanditBear linter object (wrapping 'bandit') at 0x7ff73c3cadd8>
  32. lines = ['import jinja2\n', 'from jinja2 import Environment\n', 'templateLoader = jinja2.FileSystemLoader( searchpath="/" )\n', "something = ''\n", '\n', 'Environment(loader=templateLoader, load=templateLoader, autoescape=True)\n', ...]
  33. results = [<Result object(id=0x7f503b767ba0428f8597dc23a550efff, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316a20>]
  34. filename = '/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py'
  35. check_order = False, force_linebreaks = True, create_tempfile = False
  36. tempfile_kwargs = {}, settings = {}
  37.  
  38.  def check_results(self,
  39.  local_bear,
  40.  lines,
  41.  results,
  42.  filename=None,
  43.  check_order=False,
  44.  force_linebreaks=True,
  45.  create_tempfile=True,
  46.  tempfile_kwargs={},
  47.  settings={}):
  48.  """
  49.  Asserts that a check of the given lines with the given local bear does
  50.  yield exactly the given results.
  51.  
  52.  :param local_bear: The local bear to check with.
  53.  :param lines: The lines to check. (List of strings)
  54.  :param results: The expected list of results.
  55.  :param filename: The filename, if it matters.
  56.  :param force_linebreaks: Whether to append newlines at each line
  57.  if needed. (Bears expect a \\n for every line)
  58.  :param create_tempfile: Whether to save lines in tempfile if needed.
  59.  :param tempfile_kwargs: Kwargs passed to tempfile.mkstemp().
  60.  :param settings: A dictionary of keys and values (both strings)
  61.  from which settings will be created that will
  62.  be made available for the tested bear.
  63.  """
  64.  assert isinstance(self, unittest.TestCase)
  65.  self.assertIsInstance(local_bear,
  66.  LocalBear,
  67.  msg='The given bear is not a local bear.')
  68.  self.assertIsInstance(lines,
  69.  (list, tuple),
  70.  msg='The given lines are not a list.')
  71.  self.assertIsInstance(results,
  72.  list,
  73.  msg='The given results are not a list.')
  74.  
  75.  with prepare_file(lines, filename,
  76.  force_linebreaks=force_linebreaks,
  77.  create_tempfile=create_tempfile,
  78.  tempfile_kwargs=tempfile_kwargs) as (file, fname), \
  79.  execute_bear(local_bear, fname, file,
  80.  **settings) as bear_output:
  81.  msg = ("The local bear '{}' doesn't yield the right results. Or "
  82.  'the order may be wrong.'
  83.  .format(local_bear.__class__.__name__))
  84.  if not check_order:
  85. > self.assertEqual(sorted(bear_output), sorted(results), msg=msg)
  86.  
  87. /usr/lib/python3.5/site-packages/coalib/testing/LocalBearTestHelper.py:130:
  88. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  89.  
  90. self = <tests.python.BanditBearTest.BanditBearTest testMethod=test_jinja2_templating>
  91. first = [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6828>]
  92. second = [<Result object(id=0x7f503b767ba0428f8597dc23a550efff, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316a20>]
  93. msg = "The local bear 'BanditBear' doesn't yield the right results. Or the order may be wrong."
  94.  
  95.  def assertEqual(self, first, second, msg=None):
  96.  """Fail if the two objects are unequal as determined by the '=='
  97.  operator.
  98.  """
  99.  assertion_func = self._getAssertEqualityFunc(first, second)
  100. > assertion_func(first, second, msg=msg)
  101.  
  102. /usr/lib64/python3.5/unittest/case.py:838:
  103. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  104.  
  105. self = <tests.python.BanditBearTest.BanditBearTest testMethod=test_jinja2_templating>
  106. list1 = [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6828>]
  107. list2 = [<Result object(id=0x7f503b767ba0428f8597dc23a550efff, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316a20>]
  108. msg = "The local bear 'BanditBear' doesn't yield the right results. Or the order may be wrong."
  109.  
  110.  def assertListEqual(self, list1, list2, msg=None):
  111.  """A list-specific equality assertion.
  112.  
  113.  Args:
  114.  list1: The first list to compare.
  115.  list2: The second list to compare.
  116.  msg: Optional message to use on failure instead of a list of
  117.  differences.
  118.  
  119.  """
  120. > self.assertSequenceEqual(list1, list2, msg, seq_type=list)
  121.  
  122. /usr/lib64/python3.5/unittest/case.py:1036:
  123. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  124.  
  125. self = <tests.python.BanditBearTest.BanditBearTest testMethod=test_jinja2_templating>
  126. seq1 = [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6828>]
  127. seq2 = [<Result object(id=0x7f503b767ba0428f8597dc23a550efff, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316a20>]
  128. msg = "Lists differ: [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin=[2507 chars]828>] != [<Result object(id=0... ++ ^^^ ^\n : The local bear 'BanditBear' doesn't yield the right results. Or the order may be wrong."
  129. seq_type = <class 'list'>
  130.  
  131.  def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None):
  132.  """An equality assertion for ordered sequences (like lists and tuples).
  133.  
  134.  For the purposes of this function, a valid ordered sequence type is one
  135.  which can be indexed, has a length, and has an equality operator.
  136.  
  137.  Args:
  138.  seq1: The first sequence to compare.
  139.  seq2: The second sequence to compare.
  140.  seq_type: The expected datatype of the sequences, or None if no
  141.  datatype should be enforced.
  142.  msg: Optional message to use on failure instead of a list of
  143.  differences.
  144.  """
  145.  if seq_type is not None:
  146.  seq_type_name = seq_type.__name__
  147.  if not isinstance(seq1, seq_type):
  148.  raise self.failureException('First sequence is not a %s: %s'
  149.  % (seq_type_name, safe_repr(seq1)))
  150.  if not isinstance(seq2, seq_type):
  151.  raise self.failureException('Second sequence is not a %s: %s'
  152.  % (seq_type_name, safe_repr(seq2)))
  153.  else:
  154.  seq_type_name = "sequence"
  155.  
  156.  differing = None
  157.  try:
  158.  len1 = len(seq1)
  159.  except (TypeError, NotImplementedError):
  160.  differing = 'First %s has no length. Non-sequence?' % (
  161.  seq_type_name)
  162.  
  163.  if differing is None:
  164.  try:
  165.  len2 = len(seq2)
  166.  except (TypeError, NotImplementedError):
  167.  differing = 'Second %s has no length. Non-sequence?' % (
  168.  seq_type_name)
  169.  
  170.  if differing is None:
  171.  if seq1 == seq2:
  172.  return
  173.  
  174.  differing = '%ss differ: %s != %s\n' % (
  175.  (seq_type_name.capitalize(),) +
  176.  _common_shorten_repr(seq1, seq2))
  177.  
  178.  for i in range(min(len1, len2)):
  179.  try:
  180.  item1 = seq1[i]
  181.  except (TypeError, IndexError, NotImplementedError):
  182.  differing += ('\nUnable to index element %d of first %s\n' %
  183.  (i, seq_type_name))
  184.  break
  185.  
  186.  try:
  187.  item2 = seq2[i]
  188.  except (TypeError, IndexError, NotImplementedError):
  189.  differing += ('\nUnable to index element %d of second %s\n' %
  190.  (i, seq_type_name))
  191.  break
  192.  
  193.  if item1 != item2:
  194.  differing += ('\nFirst differing element %d:\n%s\n%s\n' %
  195.  ((i,) + _common_shorten_repr(item1, item2)))
  196.  break
  197.  else:
  198.  if (len1 == len2 and seq_type is None and
  199.  type(seq1) != type(seq2)):
  200.  # The sequences are the same, but have differing types.
  201.  return
  202.  
  203.  if len1 > len2:
  204.  differing += ('\nFirst %s contains %d additional '
  205.  'elements.\n' % (seq_type_name, len1 - len2))
  206.  try:
  207.  differing += ('First extra element %d:\n%s\n' %
  208.  (len2, safe_repr(seq1[len2])))
  209.  except (TypeError, IndexError, NotImplementedError):
  210.  differing += ('Unable to index element %d '
  211.  'of first %s\n' % (len2, seq_type_name))
  212.  elif len1 < len2:
  213.  differing += ('\nSecond %s contains %d additional '
  214.  'elements.\n' % (seq_type_name, len2 - len1))
  215.  try:
  216.  differing += ('First extra element %d:\n%s\n' %
  217.  (len1, safe_repr(seq2[len1])))
  218.  except (TypeError, IndexError, NotImplementedError):
  219.  differing += ('Unable to index element %d '
  220.  'of second %s\n' % (len1, seq_type_name))
  221.  standardMsg = differing
  222.  diffMsg = '\n' + '\n'.join(
  223.  difflib.ndiff(pprint.pformat(seq1).splitlines(),
  224.  pprint.pformat(seq2).splitlines()))
  225.  
  226.  standardMsg = self._truncateMessage(standardMsg, diffMsg)
  227.  msg = self._formatMessage(msg, standardMsg)
  228. > self.fail(msg)
  229.  
  230. /usr/lib64/python3.5/unittest/case.py:1018:
  231. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  232.  
  233. self = <tests.python.BanditBearTest.BanditBearTest testMethod=test_jinja2_templating>
  234. msg = "Lists differ: [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin=[2507 chars]828>] != [<Result object(id=0... ++ ^^^ ^\n : The local bear 'BanditBear' doesn't yield the right results. Or the order may be wrong."
  235.  
  236.  def fail(self, msg=None):
  237.  """Fail immediately, with the given message."""
  238. > raise self.failureException(msg)
  239. E AssertionError: Lists differ: [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin=[2507 chars]828>] != [<Result object(id=0x7f503b767ba0428f8597dc23a550efff, origin=[2506 chars]a20>]
  240. E 
  241. E First differing element 1:
  242. E <Result object(id=0x64fa286a5b5e4d69b23c9c3d5bb78892, origin=[581 chars]6630>
  243. E <Result object(id=0x988f59b3835842adaf592604c4b20b45, origin=[580 chars]67f0>
  244. E 
  245. E - [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=9, column=None) at 0x7ff73c3f62b0>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=9, column=None) at 0x7ff73c3f6240>) at 0x7ff73c3f6390>,), severity=MAJOR, confidence=70, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Ensure autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6048>,
  246. E + [<Result object(id=0x7f503b767ba0428f8597dc23a550efff, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=9, column=None) at 0x7ff7483161d0>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=9, column=None) at 0x7ff748316208>) at 0x7ff748316160>,), severity=MAJOR, confidence=70, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Ensure autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316128>,
  247. E - <Result object(id=0x64fa286a5b5e4d69b23c9c3d5bb78892, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=10, column=None) at 0x7ff73c3f62e8>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=10, column=None) at 0x7ff73c3f6320>) at 0x7ff73c3f63c8>,), severity=MAJOR, confidence=90, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6630>,
  248. E ? ^^^^ ^^^ --------------------- ^ ^^^ ^^ ^^^ ^^ ^^^ ^^ - ^^^ ^^
  249. E 
  250. E + <Result object(id=0x988f59b3835842adaf592604c4b20b45, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=10, column=None) at 0x7ff7483160b8>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=10, column=None) at 0x7ff7483160f0>) at 0x7ff748316048>,), severity=MAJOR, confidence=90, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True to mitigate XSS vulnerabilties.', aspect=NoneType) at 0x7ff7483167f0>,
  251. E ? ^^^^^^^^^^^^^ ^^^^ ^^^^^^^^^^^^ ++ ^ ^^ ++ ^ ^^ ++ ^ ^^ ++ ^ ^^
  252. E 
  253. E - <Result object(id=0x2e96a774263f4eee9bc254a442af3785, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=11, column=None) at 0x7ff73c3f65c0>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=13, column=None) at 0x7ff73c3f6518>) at 0x7ff73c3f6588>,), severity=MAJOR, confidence=90, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f65f8>,
  254. E ? ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^ ^^ ^^^^ ^^ ^^^^ ^^^ ^^^^ ^^
  255. E 
  256. E + <Result object(id=0x9f8e324d182a49d38848763b14c38a45, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=11, column=None) at 0x7ff748316860>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=13, column=None) at 0x7ff748316828>) at 0x7ff7483168d0>,), severity=MAJOR, confidence=90, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316908>,
  257. E ? +++++ ^^^^^^^ +++++++ ^^^^^^^^^ ^ ^^^^ ^^ ^^^^ ^^ ^^^^ ^^^ ^^^^ ^^
  258. E 
  259. E - <Result object(id=0xf277bd296f5841f3a8d4225f89d6fe05, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=15, column=None) at 0x7ff73c3f6898>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=16, column=None) at 0x7ff73c3f6438>) at 0x7ff73c3f6860>,), severity=MAJOR, confidence=90, message='By default, jinja2 sets autoescape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6828>]
  260. E ? ^^^^^^^ ^^ ---- ^^^^^^^^^ ^^^^^^^ ^^^^^ ^^^^ ^^ ^^^^^^^ ^^^^^ ^
  261. E 
  262. E + <Result object(id=0x5763b9dde3dc476ea8041e6538eb69c8, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=15, column=None) at 0x7ff748316978>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=16, column=None) at 0x7ff748316940>) at 0x7ff7483169e8>,), severity=MAJOR, confidence=90, message='By default, jinja2 sets autoescape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316a20>]
  263. E ? ^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^ ^^^ ++ ^^ + ++ ^^^ ^ ++ ^^^^^ ++ ^^^ ^
  264. E : The local bear 'BanditBear' doesn't yield the right results. Or the order may be wrong.
  265.  
  266. /usr/lib64/python3.5/unittest/case.py:683: AssertionError
  267.  
  268. During handling of the above exception, another exception occurred:
  269.  
  270. self = <tests.python.BanditBearTest.BanditBearTest testMethod=test_jinja2_templating>
  271.  
  272.  def test_function(self):
  273.  self.maxDiff = None
  274.  bear = BanditBear(Section(''), Queue())
  275.  self.check_results(bear, load_testfile(testfilename, True),
  276.  expected_results, get_testfile_path(testfilename),
  277. > create_tempfile=False)
  278.  
  279. tests/python/BanditBearTest.py:33:
  280. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  281. /usr/lib/python3.5/site-packages/coalib/testing/LocalBearTestHelper.py:132: in check_results
  282.  self.assertEqual(bear_output, results, msg=msg)
  283. /usr/lib64/python3.5/contextlib.py:77: in __exit__
  284.  self.gen.throw(type, value, traceback)
  285. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  286.  
  287. bear = <BanditBear linter object (wrapping 'bandit') at 0x7ff73c3cadd8>
  288. args = ('/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', ['import jinja2\n', 'from jinja2 imp..."/" )\n', "something = ''\n", '\n', 'Environment(loader=templateLoader, load=templateLoader, autoescape=True)\n', ...])
  289. kwargs = {}
  290. bear_output_generator = [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin='B701', affected_code=(<SourceRange object(start=<Source...escape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6828>]
  291. msg = ['Running bear BanditBear...', "Running 'bandit /home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py -f json -s B105,B106,B107,B404,B603,B606,B607'"]
  292.  
  293.  @contextmanager
  294.  def execute_bear(bear, *args, **kwargs):
  295.  try:
  296.  bear_output_generator = bear.execute(*args, **kwargs)
  297.  assert bear_output_generator is not None, \
  298.  'Bear returned None on execution\n'
  299.  yield bear_output_generator
  300.  except Exception as err:
  301.  msg = []
  302.  while not bear.message_queue.empty():
  303.  msg.append(bear.message_queue.get().message)
  304. > raise AssertionError(str(err) + ' \n' + '\n'.join(msg))
  305. E AssertionError: Lists differ: [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin=[2507 chars]828>] != [<Result object(id=0x7f503b767ba0428f8597dc23a550efff, origin=[2506 chars]a20>]
  306. E 
  307. E First differing element 1:
  308. E <Result object(id=0x64fa286a5b5e4d69b23c9c3d5bb78892, origin=[581 chars]6630>
  309. E <Result object(id=0x988f59b3835842adaf592604c4b20b45, origin=[580 chars]67f0>
  310. E 
  311. E - [<Result object(id=0xca7a8528629c4f83a4e1ad6c4627ca2a, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=9, column=None) at 0x7ff73c3f62b0>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=9, column=None) at 0x7ff73c3f6240>) at 0x7ff73c3f6390>,), severity=MAJOR, confidence=70, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Ensure autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6048>,
  312. E + [<Result object(id=0x7f503b767ba0428f8597dc23a550efff, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=9, column=None) at 0x7ff7483161d0>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=9, column=None) at 0x7ff748316208>) at 0x7ff748316160>,), severity=MAJOR, confidence=70, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Ensure autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316128>,
  313. E - <Result object(id=0x64fa286a5b5e4d69b23c9c3d5bb78892, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=10, column=None) at 0x7ff73c3f62e8>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=10, column=None) at 0x7ff73c3f6320>) at 0x7ff73c3f63c8>,), severity=MAJOR, confidence=90, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6630>,
  314. E ? ^^^^ ^^^ --------------------- ^ ^^^ ^^ ^^^ ^^ ^^^ ^^ - ^^^ ^^
  315. E 
  316. E + <Result object(id=0x988f59b3835842adaf592604c4b20b45, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=10, column=None) at 0x7ff7483160b8>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=10, column=None) at 0x7ff7483160f0>) at 0x7ff748316048>,), severity=MAJOR, confidence=90, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True to mitigate XSS vulnerabilties.', aspect=NoneType) at 0x7ff7483167f0>,
  317. E ? ^^^^^^^^^^^^^ ^^^^ ^^^^^^^^^^^^ ++ ^ ^^ ++ ^ ^^ ++ ^ ^^ ++ ^ ^^
  318. E 
  319. E - <Result object(id=0x2e96a774263f4eee9bc254a442af3785, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=11, column=None) at 0x7ff73c3f65c0>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=13, column=None) at 0x7ff73c3f6518>) at 0x7ff73c3f6588>,), severity=MAJOR, confidence=90, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f65f8>,
  320. E ? ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^ ^^ ^^^^ ^^ ^^^^ ^^^ ^^^^ ^^
  321. E 
  322. E + <Result object(id=0x9f8e324d182a49d38848763b14c38a45, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=11, column=None) at 0x7ff748316860>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=13, column=None) at 0x7ff748316828>) at 0x7ff7483168d0>,), severity=MAJOR, confidence=90, message='Using jinja2 templates with autoescape=False is dangerous and can lead to XSS. Use autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316908>,
  323. E ? +++++ ^^^^^^^ +++++++ ^^^^^^^^^ ^ ^^^^ ^^ ^^^^ ^^ ^^^^ ^^^ ^^^^ ^^
  324. E 
  325. E - <Result object(id=0xf277bd296f5841f3a8d4225f89d6fe05, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=15, column=None) at 0x7ff73c3f6898>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=16, column=None) at 0x7ff73c3f6438>) at 0x7ff73c3f6860>,), severity=MAJOR, confidence=90, message='By default, jinja2 sets autoescape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff73c3f6828>]
  326. E ? ^^^^^^^ ^^ ---- ^^^^^^^^^ ^^^^^^^ ^^^^^ ^^^^ ^^ ^^^^^^^ ^^^^^ ^
  327. E 
  328. E + <Result object(id=0x5763b9dde3dc476ea8041e6538eb69c8, origin='B701', affected_code=(<SourceRange object(start=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=15, column=None) at 0x7ff748316978>, end=<SourcePosition object(file='/home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py', line=16, column=None) at 0x7ff748316940>) at 0x7ff7483169e8>,), severity=MAJOR, confidence=90, message='By default, jinja2 sets autoescape to False. Consider using autoescape=True to mitigate XSS vulnerabilities.', aspect=NoneType) at 0x7ff748316a20>]
  329. E ? ^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^ ^^^ ++ ^^ + ++ ^^^ ^ ++ ^^^^^ ++ ^^^ ^
  330. E : The local bear 'BanditBear' doesn't yield the right results. Or the order may be wrong. 
  331. E Running bear BanditBear...
  332. E Running 'bandit /home/mak/dev/coala-bears/tests/python/bandit_test_files/jinja2_templating.py -f json -s B105,B106,B107,B404,B603,B606,B607'
  333.  
  334. /usr/lib/python3.5/site-packages/coalib/testing/LocalBearTestHelper.py:25: AssertionError
  335. ============================ pytest-warning summary ============================
  336. WC1 /home/mak/dev/coala-bears/tests/natural_language/LanguageToolBearTest.py cannot collect test class 'SkipTest' because it has a __init__ constructor
  337. ============================= 621 tests deselected =============================
  338. ==== 1 failed, 6 passed, 621 deselected, 1 pytest-warnings in 27.61 seconds ====
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement