Closed moxli closed 10 months ago
@moxli I made a PR for this issue. See linked PR.
@manuel-sommer awesome thank you!
One thing I noticed is that this change might cause some issues?
The "osvdb" field in all databases has been renamed to "references"
Apparently the medium severity is assigned automatically if an entry in ovsdb exists: https://github.com/DefectDojo/django-DefectDojo/blob/ccd711a8ffc838e820ce4b7302840080adceff87/dojo/tools/nikto/parser.py#L73
This might not be feasible anymore since the references field can be anything.
The references fields in your example do not reflect the severity. But you are right, I can add the references field in finding.reference. I will push a fix today.
@manuel-sommer awesome thank you!
One thing I noticed is that this change might cause some issues?
The "osvdb" field in all databases has been renamed to "references"
Apparently the medium severity is assigned automatically if an entry in ovsdb exists:
This might not be feasible anymore since the references field can be anything.
done, could you take a look?
@manuel-sommer hm I think this would break backwards compatibility since the old json format does not have the references field.
I think we should check if the field exists before accessing it.
In my opinion backwards compatibility shall be maintained because Nikto 2.1.5 is still widely available. Example: https://packages.ubuntu.com/search?keywords=nikto
I know that backwards compatibility is crucial. I guess this does not break backwards compatibility and also the unittests did not fail.
@manuel-sommer Ah nice perfect :)
I think I miss interpreted the message I got when I tried to import the new format:
[04/Jan/2024 10:03:46] ERROR [dojo.api_v2.exception_handler:36] 'list' object has no attribute 'get'
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rest_framework/mixins.py", line 19, in create
self.perform_create(serializer)
File "/app/dojo/api_v2/views.py", line 3238, in perform_create
serializer.save(push_to_jira=push_to_jira)
File "/app/dojo/api_v2/serializers.py", line 2502, in save
) = reimporter.reimport_scan(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/importers/reimporter/reimporter.py", line 609, in reimport_scan
parsed_findings = parser.get_findings(scan, test)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/tools/nikto/parser.py", line 40, in get_findings
return self.process_json(filename, test)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/tools/nikto/parser.py", line 48, in process_json
host = data.get("host")
^^^^^^^^
This was due to the fact that the entire thing is an array now and not because it could not find the "host" field?
I thought, that the parser fails if a field like references can not be found.
This can be closed @mtesauro
Scanner Name Nikto 2.5.0 has introduced breaking changes to the JSON output format.
https://github.com/sullo/nikto/wiki/2.5.0-Potentially-Breaking-Changes
Sample File