Skip to content

fix: add CVSSv4 support to auditjs parser and improve error handling #12391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: bugfix
Choose a base branch
from

Conversation

Haralishev77
Copy link

Summary

This PR adds CVSS v4 support to the AuditJS parser in DefectDojo.

Changes

  • Updated the parser logic to handle CVSS:4.0 vectors using the CVSS4 class.
  • Added clear error handling when no CVSS vectors are found.
  • Ensured backward compatibility with CVSS2 and CVSS3.

Note

Support for CVSS4 relies on RedHatProductSecurity/cvss#75 being merged and released (likely in version 3.5).
Once it's available, the requirements.txt should be updated accordingly.

@github-actions github-actions bot added the parser label May 6, 2025
@Haralishev77 Haralishev77 marked this pull request as draft May 6, 2025 14:02
Copy link

dryrunsecurity bot commented May 6, 2025

DryRun Security

This pull request addresses potential security vulnerabilities including DOMPurify XSS issues, a high-severity MySQL certificate verification vulnerability, and modifications to CVSS parsing and testing in the AuditJS parser, with associated updates to test cases and dependency handling.

💭 Unconfirmed Findings (6)
Vulnerability CVSS Parsing Errors
Description Potential unexpected behavior when encountering invalid or malformed CVSS vectors in dojo/tools/auditjs/parser.py, with explicit errors raised for unsupported CVSS versions
Vulnerability Dependency Import Change
Description Potential version compatibility issues due to changes in dependency resolution in dojo/tools/auditjs/parser.py
Vulnerability DOMPurify XSS Vulnerabilities
Description Two CVEs (CVE-2024-47875 and CVE-2025-26791) with CVSS scores of 6.4 and 2.1, indicating improper neutralization of input during web page generation
Vulnerability MySQL Unverified Certificate Vulnerability
Description High-severity CVSS 9.6 vulnerability with potential risk of man-in-the-middle attacks or connection spoofing due to improper SSL certificate verification
Vulnerability Test Case Modification
Description Changes in vulnerability parsing and testing approach in unittests/tools/test_auditjs_parser.py
Vulnerability Test Coverage Expansion
Description Modifications to test coverage for vulnerability detection in unittests/tools/test_auditjs_parser.py

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

@valentijnscholten
Copy link
Member

valentijnscholten commented May 6, 2025

Thank you for the PR. Can you look at my comment, the linting errors and rebase against the bugfix branch?

@Haralishev77 Haralishev77 force-pushed the fix/auditjs-cvss4-support branch from 5a8ace2 to 594038c Compare May 7, 2025 09:17
@valentijnscholten valentijnscholten changed the base branch from master to bugfix May 7, 2025 18:47
@valentijnscholten
Copy link
Member

Thanks, I've updated the base branch here on the GitHub PR as well.

Could you look at providing/updating a test case that covers the new CVSS code?

@Haralishev77
Copy link
Author

Sure, I’ll take a look at the test file next week and may extend it with additional scan examples to cover CVSS v2 and v4 cases.

@Haralishev77
Copy link
Author

Haralishev77 commented May 13, 2025

I've added new tests for CVSS V2 and V4 vectors and updated the scan examples. However, to run the tests properly, it's necessary to manually add the updated parse_cvss_from_text function to the auditjs parser (for now).

@valentijnscholten
Copy link
Member

Thanks! I've approved the workflows to run, can you look at the test failure: https://github.com/DefectDojo/django-DefectDojo/actions/runs/15003307072/job/42158252920?pr=12391#step:8:3482

@Haralishev77
Copy link
Author

Yes, this error occurs due to missing functionality in the CVSS library. So, we're waiting for updates.

uwsgi-1  |   File "/app/dojo/tools/auditjs/parser.py", line 119, in get_findings
uwsgi-1  |     raise ValueError(msg)
uwsgi-1  | ValueError: No CVSS vectors found. Please check that parse_cvss_from_text() correctly parses the provided cvssVector.

Copy link
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.

@Haralishev77 I think it would be fine if you add some extra code to handle the CVSS4 case, i.e. mimic what your upstream PR does. I am saying this because it looks like it might take a while before RedHat will release a version with your fix/enhancement. And soon we will add CVSS4 support to Defect Dojo and that will be a point where we will double check all CVSS related code in parsers and could cleanup the extra code.

@Haralishev77
Copy link
Author

Okay, I’ll push the changes soon.

@valentijnscholten valentijnscholten self-requested a review May 16, 2025 21:16
@valentijnscholten valentijnscholten dismissed their stale review May 16, 2025 21:17

changes implemented

Copy link
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.

Looks good to me, feel free to take it out of draft.

@Haralishev77 Haralishev77 marked this pull request as ready for review May 17, 2025 09:01
@Maffooch Maffooch requested a review from hblankenship May 22, 2025 03:48
Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

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

Approved

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