failmap/admin

View on GitHub

Showing 577 of 577 total issues

Avoid deeply nested control flow statements.
Open

                    for endpoint in url["endpoints"]:

                        # Only add the endpoint once for a series of ratings. And only if the
                        # ratings is not a repeated finding.
                        added_endpoint = False
Severity: Major
Found in websecmap/map/report.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        for endpoint in urlrating["endpoints"]:
    
                            for rating in endpoint["ratings"]:
                                if rating["type"] not in measurement:
                                    measurement[rating["type"]] = {
    Severity: Major
    Found in websecmap/map/report.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if (
                              endpoint_rating["type"] in desired_endpoint_scans
                              and endpoint_rating.get("comply_or_explain_valid_at_time_of_report", False) is False
                          ):
                              high += endpoint_rating["high"]
      Severity: Major
      Found in websecmap/map/logic/map.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if url["url"] in noduplicates:
                                continue
                            noduplicates.append(url["url"])
        Severity: Major
        Found in websecmap/map/report.py - About 45 mins to fix

          Function add_configuration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def add_configuration(country: str, organization_type: int):
          
              if models.Configuration.objects.all().filter(country=country, organization_type=organization_type).exists():
                  log.debug("This configuration already exists, skipping.")
                  return
          Severity: Minor
          Found in websecmap/map/admin.py - About 45 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_task has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def compose_task(
              organizations_filter: dict = dict(),
              urls_filter: dict = dict(),
              endpoints_filter: dict = dict(),
          ) -> Task:
          Severity: Minor
          Found in websecmap/map/report.py - About 45 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 reorder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def reorder(self, request, queryset):
          
                  first_order = None
          
                  for configuration in queryset:
          Severity: Minor
          Found in websecmap/map/admin.py - About 45 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

          Avoid deeply nested control flow statements.
          Open

                              for rating in urlrating["ratings"]:
          
                                  # log.debug("- type: %s H: %s, M: %s, L: %s" %
                                  #     (rating['type'], rating['high'], rating['medium'], rating['low']))
          
          
          Severity: Major
          Found in websecmap/map/report.py - About 45 mins to fix

            Similar blocks of code found in 5 locations. Consider refactoring.
            Open

                            "categories": {
                                "web_ipv6": {"verdict": "passed", "status": "passed"},
                                "web_dnssec": {"verdict": "failed", "status": "failed"},
                                "web_https": {"verdict": "failed", "status": "failed"},
                                "web_appsecpriv": {"verdict": "warning", "status": "warning"},
            Severity: Major
            Found in websecmap/scanners/tests/test_internet_nl_v2.py and 4 other locations - About 45 mins to fix
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 130..134
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 537..541
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 818..822
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 871..875

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                del sixth_report.calculation["endpoints"][0]["ratings"][0]["last_scan"]
            Severity: Major
            Found in websecmap/reporting/tests/test_create_url_report.py and 2 other locations - About 45 mins to fix
            websecmap/reporting/tests/test_create_url_report.py on lines 153..153
            websecmap/reporting/tests/test_create_url_report.py on lines 238..238

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 5 locations. Consider refactoring.
            Open

                            "categories": {
                                "web_ipv6": {"verdict": "failed", "status": "failed"},
                                "web_dnssec": {"verdict": "passed", "status": "passed"},
                                "web_https": {"verdict": "unreachable", "status": "error"},
                                "web_appsecpriv": {"verdict": "warning", "status": "warning"},
            Severity: Major
            Found in websecmap/scanners/tests/test_internet_nl_v2.py and 4 other locations - About 45 mins to fix
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 130..134
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 246..250
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 537..541
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 818..822

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 5 locations. Consider refactoring.
            Open

                            "categories": {
                                "mail_ipv6": {"verdict": "failed", "status": "failed"},
                                "mail_dnssec": {"verdict": "passed", "status": "passed"},
                                "mail_auth": {"verdict": "passed", "status": "passed"},
                                "mail_starttls": {"verdict": "failed", "status": "failed"},
            Severity: Major
            Found in websecmap/scanners/tests/test_internet_nl_v2.py and 4 other locations - About 45 mins to fix
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 130..134
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 246..250
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 818..822
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 871..875

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                url, created = Url.objects.all().get_or_create(
                    url="test.nl", created_on=timezone.now(), is_dead=False, not_resolvable=False
            Severity: Major
            Found in websecmap/map/tests/test_map_datasets.py and 2 other locations - About 45 mins to fix
            websecmap/map/tests/test_map_datasets.py on lines 52..53
            websecmap/map/tests/test_map_datasets.py on lines 60..61

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 5 locations. Consider refactoring.
            Open

                            "categories": {
                                "mail_ipv6": {"verdict": "failed", "status": "failed"},
                                "mail_dnssec": {"verdict": "passed", "status": "passed"},
                                "mail_auth": {"verdict": "passed", "status": "passed"},
                                "mail_starttls": {"verdict": "failed", "status": "failed"},
            Severity: Major
            Found in websecmap/scanners/tests/test_internet_nl_v2.py and 4 other locations - About 45 mins to fix
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 130..134
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 246..250
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 537..541
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 871..875

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                del fourth_report.calculation["endpoints"][0]["ratings"][0]["last_scan"]
            Severity: Major
            Found in websecmap/reporting/tests/test_create_url_report.py and 2 other locations - About 45 mins to fix
            websecmap/reporting/tests/test_create_url_report.py on lines 238..238
            websecmap/reporting/tests/test_create_url_report.py on lines 248..248

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 5 locations. Consider refactoring.
            Open

                            "categories": {
                                "web_ipv6": {"verdict": "failed", "status": "failed"},
                                "web_dnssec": {"verdict": "passed", "status": "passed"},
                                "web_https": {"verdict": "failed", "status": "failed"},
                                "web_appsecpriv": {"verdict": "warning", "status": "warning"},
            Severity: Major
            Found in websecmap/scanners/tests/test_internet_nl_v2.py and 4 other locations - About 45 mins to fix
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 246..250
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 537..541
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 818..822
            websecmap/scanners/tests/test_internet_nl_v2.py on lines 871..875

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                url, created = Url.objects.all().get_or_create(
                    url="test2.nl", created_on=timezone.now(), is_dead=False, not_resolvable=False
            Severity: Major
            Found in websecmap/map/tests/test_map_datasets.py and 2 other locations - About 45 mins to fix
            websecmap/map/tests/test_map_datasets.py on lines 44..45
            websecmap/map/tests/test_map_datasets.py on lines 60..61

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                url, created = Url.objects.all().get_or_create(
                    url="test3.nl", created_on=timezone.now(), is_dead=False, not_resolvable=False
            Severity: Major
            Found in websecmap/map/tests/test_map_datasets.py and 2 other locations - About 45 mins to fix
            websecmap/map/tests/test_map_datasets.py on lines 44..45
            websecmap/map/tests/test_map_datasets.py on lines 52..53

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                del fifth_report.calculation["endpoints"][0]["ratings"][0]["last_scan"]
            Severity: Major
            Found in websecmap/reporting/tests/test_create_url_report.py and 2 other locations - About 45 mins to fix
            websecmap/reporting/tests/test_create_url_report.py on lines 153..153
            websecmap/reporting/tests/test_create_url_report.py on lines 248..248

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 35.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                worker_process = subprocess.Popen(
                    worker_command, stdout=sys.stdout.buffer, stderr=sys.stderr.buffer, preexec_fn=os.setsid, env=worker_env
            Severity: Minor
            Found in tests/integration/integration_scanners/conftest.py and 1 other location - About 40 mins to fix
            tests/integration/conftest.py on lines 42..43

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 34.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language