avocado-framework/avocado

View on GitHub
selftests/functional/output.py

Summary

Maintainability
C
1 day
Test Coverage

Using minidom to parse untrusted XML data is known to be vulnerable to XML attacks. Replace minidom with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Open

from xml.dom import minidom

Severity: Info
Found in selftests/functional/output.py by bandit

Using xml.dom.minidom.parseString to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.minidom.parseString with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Open

        minidom.parseString(result.stdout_text)
Severity: Minor
Found in selftests/functional/output.py by bandit

Using xml.dom.minidom.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.minidom.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Open

            minidom.parse(xunit_output_path)
Severity: Minor
Found in selftests/functional/output.py by bandit

Function call with shell=True parameter identified, possible security issue.
Open

        result = process.run(
            cmd_line, shell=True, ignore_status=True, env={"LC_ALL": "C"}
Severity: Minor
Found in selftests/functional/output.py by bandit

Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Open

    return os.system("perl -e 'use TAP::Parser;'") != 0
Severity: Info
Found in selftests/functional/output.py by bandit

Using xml.dom.minidom.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.minidom.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Open

        minidom.parse(tmpfile)
Severity: Minor
Found in selftests/functional/output.py by bandit

Using xml.dom.minidom.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.dom.minidom.parse with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Open

        minidom.parse(tmpfile)
Severity: Minor
Found in selftests/functional/output.py by bandit

Starting a process with a partial executable path
Open

    return os.system("perl -e 'use TAP::Parser;'") != 0
Severity: Info
Found in selftests/functional/output.py by bandit

Function call with shell=True parameter identified, possible security issue.
Open

        result = process.run(cmd_line, ignore_status=True, shell=True)
Severity: Minor
Found in selftests/functional/output.py by bandit

File output.py has 582 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import os
import re
import shlex
import unittest
Severity: Major
Found in selftests/functional/output.py - About 1 day to fix

    Function _check_output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _check_output(self, path, exps):
            i = 0
            end = len(exps)
            with open(path, "rb") as output_file:  # pylint: disable=W1514
                output_file_content = output_file.read()
    Severity: Minor
    Found in selftests/functional/output.py - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    There are no issues that match your filters.

    Category
    Status