Skip to content

Can't import Nexpose Scans without "Scan Completion Date" #9712

@DarkR0ast

Description

@DarkR0ast

Bug description
When you try to import a Nexpose report and don't specify a "Scan Completion Date", the import will fail. Pretty sure this is due to changes made in #9473. Doesn't happen with Burp imports for example. Disabling Finding SLA's and trying the import again causes another import error.

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a new engagement
  2. Upload test
  3. Select Nexpose Scan
  4. Don't specify a "Scan Completion Date"
  5. Failes import

Expected behavior
Successful import

Deployment method (select with an X)

  • [x ] Docker Compose
  • Kubernetes
  • GoDojo

Environment information
Ubuntu 18.04
DefectDojo version v. 2.31.5

Logs

[11/Mar/2024 12:58:49] ERROR [dojo.engagement.views:750] unsupported operand type(s) for -: 'datetime.date' and 'NoneType'

Traceback (most recent call last):

  File "/app/dojo/engagement/views.py", line 734, in post

    test, finding_count, closed_finding_count, _ = importer.import_scan(scan, scan_type, engagement, user, environment, active=active, verified=verified, tags=tags,

                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/dojo/importers/importer/importer.py", line 344, in import_scan

    new_findings = self.process_parsed_findings(test, parsed_findings, scan_type, user, active=active,

                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/dojo/decorators.py", line 48, in __wrapper__

    return func(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/celery/local.py", line 182, in __call__

    return self._get_current_object()(*a, **kw)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/celery/app/task.py", line 411, in __call__

    return self.run(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/dojo/importers/importer/importer.py", line 110, in process_parsed_findings

    item.save(dedupe_option=False)

  File "/app/dojo/models.py", line 3029, in save

    self.set_sla_expiration_date()

  File "/app/dojo/models.py", line 2882, in set_sla_expiration_date

    days_remaining = sla_period - self.sla_age

                                  ^^^^^^^^^^^^

  File "/app/dojo/models.py", line 2862, in sla_age

    return self._age(self.get_sla_start_date())

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/dojo/models.py", line 2852, in _age

    diff = get_current_date() - start_date

           ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

TypeError: unsupported operand type(s) for -: 'datetime.date' and 'NoneType'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions