Skip to content

Generic parser update#13139

Merged
valentijnscholten merged 6 commits intoDefectDojo:bugfixfrom
mykhailo-sindieiev:generic-parser-update
Sep 12, 2025
Merged

Generic parser update#13139
valentijnscholten merged 6 commits intoDefectDojo:bugfixfrom
mykhailo-sindieiev:generic-parser-update

Conversation

@mykhailo-sindieiev
Copy link
Copy Markdown
Contributor

@mykhailo-sindieiev mykhailo-sindieiev commented Sep 8, 2025

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.json and unittests/scans/generic/generic_report_kev_cvssv4.csv are successfully parsed with updated parsers

Documentation

docs/content/en/connecting_your_tools/parsers/file/generic.md is updated

@Maffooch Maffooch changed the base branch from master to bugfix September 8, 2025 19:48
Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@mykhailo-sindieiev
Copy link
Copy Markdown
Contributor Author

Hello, thank you for the review. Working on changes

@dryrunsecurity
Copy link
Copy Markdown

dryrunsecurity Bot commented Sep 11, 2025

DryRun Security

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 dojo/tools/generic/csv_parser.py
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.

if len(cvss_objects) > 0:
finding.cvssv3 = cvss_objects[0].clean_vector()
if "CVSSV4" in row:
cvss4_objects = cvss_parser.parse_cvss_from_text(row["CVSSV4"])
if len(cvss4_objects) > 0:
finding.cvssv4 = cvss4_objects[0].clean_vector()
if "CVSSV4_score" in row:
finding.cvssv4_score = float(row["CVSSV4_score"])
if "kev_date" in row:
finding.kev_date = parse(row["kev_date"])
if "known_exploited" in row:
finding.known_exploited = bool(row["known_exploited"])
if "ransomware_used" in row:
finding.ransomware_used = bool(row["ransomware_used"])
if "fix_available" in row:
finding.fix_available = bool(row["fix_available"])
# manage endpoints
if "Url" in row:
finding.unsaved_endpoints = [


All finding details can be found in the DryRun Security Dashboard.

@mykhailo-sindieiev
Copy link
Copy Markdown
Contributor Author

@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?

@valentijnscholten
Copy link
Copy Markdown
Member

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

@github-actions github-actions Bot added the docs label Sep 12, 2025
@mykhailo-sindieiev mykhailo-sindieiev force-pushed the generic-parser-update branch 2 times, most recently from 26c7468 to 39938dc Compare September 12, 2025 12:24
@mykhailo-sindieiev
Copy link
Copy Markdown
Contributor Author

@valentijnscholten
Copy link
Copy Markdown
Member

Thanks a lot!

@valentijnscholten valentijnscholten merged commit a998a9b into DefectDojo:bugfix Sep 12, 2025
152 of 153 checks passed
@valentijnscholten valentijnscholten added this to the 2.50.2 milestone Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants