failmap/admin

View on GitHub

Showing 267 of 577 total issues

Function organization_report_by_id has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def organization_report_by_id(
Severity: Minor
Found in websecmap/map/views.py - About 35 mins to fix

    Function improvements has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def improvements(
    Severity: Minor
    Found in websecmap/map/views.py - About 35 mins to fix

      Function explain has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def explain(scan_id: int, scan_type: str, explanation: str, explained_by: str, days: int = 365) -> Dict[str, Any]:
      Severity: Minor
      Found in websecmap/map/logic/explain.py - About 35 mins to fix

        Function organization_report_by_name has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def organization_report_by_name(
        Severity: Minor
        Found in websecmap/map/views.py - About 35 mins to fix

          Function map_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def map_data(
          Severity: Minor
          Found in websecmap/map/views.py - About 35 mins to fix

            Function inquire_organization has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def inquire_organization():
                """
                Get one or more organizations to add urls to.
                :return:
                """
            Severity: Minor
            Found in websecmap/organizations/management/commands/add_urls.py - About 35 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

            Function scan_tasks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def scan_tasks(url_chunk):
                tasks = []
            
                for scanner in DEFAULT_SCANNERS:
                    # Tls qualys scans are inserted per 25. This is due to behaviour of the qualys service.
            Severity: Minor
            Found in websecmap/scanners/tasks.py - About 35 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

            Function compose has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def compose(self, *args, **options):
                    scanners = [
                        dnssec,
                        ftp,
                        http,
            Severity: Minor
            Found in websecmap/scanners/management/commands/plan_consume.py - About 35 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

            Function get_ipv6 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_ipv6(url: str):
                # https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
                ipv6 = ""
            
                try:
            Severity: Minor
            Found in websecmap/scanners/scanner/http.py - About 35 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

            Function qualys_scan_bulk has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def qualys_scan_bulk(proxy: Dict[str, Any], urls: List[str]):
            
                log.debug("Initiating bulk scan")
                log.debug("Received proxy: %s" % proxy)
                log.debug("Received urls: %s" % urls)
            Severity: Minor
            Found in websecmap/scanners/scanner/tls_qualys.py - About 35 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

            Function get_cert_chain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_cert_chain(url, port, ip_version) -> List[OpenSSL.crypto.X509]:
                # https://stackoverflow.com/questions/19145097/getting-certificate-chain-with-python-3-3-ssl-module
                # Relatively new Dutch governmental sites relying on anything less < TLS 1.2 is insane.
                log.debug(f"Retrieving certificate chain from {url}:{port}.")
                try:
            Severity: Minor
            Found in websecmap/scanners/scanner/autoexplain_dutch_untrusted_cert.py - About 35 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

            Function askreset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def askreset():
            
                # The dev dataset should not mean anything.
                if settings.DEBUG:
                    and_its_gone()
            Severity: Minor
            Found in websecmap/organizations/management/commands/clear_database.py - About 35 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

            Function list_outdated has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def list_outdated(published_scan_types):
                for map_configuration in filter_map_configs():
                    print(f"Outdated items for {map_configuration['country']}/{map_configuration['organization_type__name']}:")
                    organizations_on_map = Organization.objects.all().filter(
                        country=map_configuration["country"], type=map_configuration["organization_type"]
            Severity: Minor
            Found in websecmap/scanners/plannedscan.py - About 35 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

            Function get_or_create_module_models has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_or_create_module_models(self, user):
                    module_models = []
            
                    i = 0
            
            
            Severity: Minor
            Found in websecmap/app/dashboard.py - About 35 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

            Function valid_api_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def valid_api_settings(scan: InternetNLV2Scan):
                if not config.INTERNET_NL_API_USERNAME:
                    update_state(
                        scan.pk,
                        "configuration_error",
            Severity: Minor
            Found in websecmap/scanners/scanner/internet_nl_v2_websecmap.py - About 35 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

            Function clean_for_organization has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def clean_for_organization(self):
                    if not self.contest:
                        raise ValidationError("You're not in a contest", "no_contest")
            
                    # mandatory check is done elsewhere.
            Severity: Minor
            Found in websecmap/game/forms.py - About 35 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

            Function check_valid_urls has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def check_valid_urls(urls):
                valid = []
            
                for url in urls:
                    url = url.lower()
            Severity: Minor
            Found in websecmap/game/admin.py - About 35 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

            Function filter_websites has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def filter_websites(sites):
                    incomplete = []
                    not_resolvable = []
                    valid = []
            
            
            Severity: Minor
            Found in websecmap/game/forms.py - About 35 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

            Function store_url_ips has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def store_url_ips(url: int, ips):
                """
                Todo: method should be stored in manager
            
                Be sure to give all ip's that are currently active in one call. Mix IPv4 and IPv6.
            Severity: Minor
            Found in websecmap/scanners/scanner/http.py - About 35 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

            Function generate_certificate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def generate_certificate(failure_mode: str = ""):
                # Code taken from https://cryptography.io/en/latest/x509/reference/
            
                one_day = datetime.timedelta(1, 0, 0)
                # weak key size, to make test faster
            Severity: Minor
            Found in websecmap/scanners/tests/test_autoexplain.py - About 35 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

            Severity
            Category
            Status
            Source
            Language