You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ahoi! There seems to be a problem with the NPM Audit parser.
In the report i do get from my tool, some paths entries are empty in the resulting json.
Example (stripped):
If i use the sample json file, the import works. But changing an arbitrary paths entry to "paths": [] will lead to the same error that i get for my result file:
DEBUG [dojo.importers.importer.importer:297] IMPORT_SCAN: Parse findings
ERROR [dojo.engagement.views:698] list index out of range
Traceback (most recent call last):
File "/app/dojo/engagement/views.py", line 682, in import_scan_results
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 300, in import_scan
parsed_findings = parser.get_findings(scan, test)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/tools/npm_audit/parser.py", line 24, in get_findings
return self.get_items(tree, test)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/tools/npm_audit/parser.py", line 55, in get_items
item = get_item(node, test)
^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/tools/npm_audit/parser.py", line 99, in get_item
file_path=censor_path_hashes(item_node['findings'][0]['paths'][0]),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
My best guess would be that the function censor_path_hashes is handling empty paths arrays incorrectly. Could you help me out here?
Ahoi! There seems to be a problem with the NPM Audit parser.
In the report i do get from my tool, some
paths
entries are empty in the resulting json.Example (stripped):
If i use the sample json file, the import works. But changing an arbitrary
paths
entry to"paths": []
will lead to the same error that i get for my result file:My best guess would be that the function censor_path_hashes is handling empty
paths
arrays incorrectly. Could you help me out here?** Reproduction **
Prepare sample file:
advisories
nodes, choose one or a few finding subnodes and change the"paths"
value to"paths": []
In DefectDojo:
Import Scan results
feature/button.Scan Type
chooseNPM Audit Scan
Also notice the log files. In my case - using a containerized environment - inspect the logs of the
uwsgi
container.The text was updated successfully, but these errors were encountered: