Generic parser update#13139
Conversation
valentijnscholten
left a comment
There was a problem hiding this comment.
Thank you for your PR and welcome as a contributor.
Would you be able to extend the PR a little bit by:
- updating the csv parser
- updating the docs
|
Hello, thank you for the review. Working on changes |
|
This pull request contains a bug in dojo/tools/generic/csv_parser.py where CSV boolean fields (known_exploited, ransomware_used, fix_available) are converted using bool(row[…]), causing any non-empty string like "False", "0" or "No" to be interpreted as True and leading to incorrect data; the issue is non-blocking but should be fixed by parsing boolean strings explicitly (e.g., comparing normalized values or using a dedicated parser).
Improper Data Conversion for Boolean Fields in
|
| Vulnerability | Improper Data Conversion for Boolean Fields |
|---|---|
| Description | The code in dojo/tools/generic/csv_parser.py incorrectly converts string representations of boolean values from CSV input. Specifically, for the fields 'known_exploited', 'ransomware_used', and 'fix_available', it uses bool(row[...]). In Python, bool() evaluates any non-empty string, including 'False', '0', or 'No', as True. This means that if a CSV file contains 'False' for these boolean fields, the application will incorrectly interpret and store them as True, leading to data integrity issues and misrepresentation of security findings. |
django-DefectDojo/dojo/tools/generic/csv_parser.py
Lines 81 to 106 in 60d89e7
All finding details can be found in the DryRun Security Dashboard.
|
@valentijnscholten Could you share the link with me where should I update the docs? I think the changes in PR are not breaking changes to mention them in upgrade docs. But should I create a file here - https://github.com/DefectDojo/django-DefectDojo/tree/master/docs/content/en/open_source/upgrading and if I should, could you please share the next release number? Is it 2.50.2? |
|
Thank you for looking into this. The doc I referred to is: https://github.com/DefectDojo/django-DefectDojo/blob/master/docs/content/en/connecting_your_tools/parsers/file/generic.md |
26c7468 to
39938dc
Compare
39938dc to
60d89e7
Compare
Done |
|
Thanks a lot! |
a998a9b
into
DefectDojo:bugfix
Description
As per discussion in #13098
New DefectDojo finding fields will be supported by Generic Importer
Test results
The files
unittests/scans/generic/generic_report_kev_cvssv4.jsonandunittests/scans/generic/generic_report_kev_cvssv4.csvare successfully parsed with updated parsersDocumentation
docs/content/en/connecting_your_tools/parsers/file/generic.mdis updated