-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Enhance OSV Parser to Include Mitigation Information with Fixed Package Versions #11681
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
Conversation
… (fixed versions)
DryRun Security SummaryThe patch improves the OSV scanner parser by enhancing vulnerability information extraction, input validation, mitigation details parsing, and adding comprehensive unit testing for security vulnerability tracking. Expand for full summarySummary: The patch enhances the OSV scanner parser in Security Findings:
|
Sorry, here is the unittest test. |
Could you also fix the ruff linter @4b75726169736859 ? |
yes just after my work day |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding empty line
@4b75726169736859 This is looking great! Thank you! There are some linter errors, and the corresponding tests might need to be updated -- could you fix those? I think you solved a tricky problem well. |
Of course, I’ll take care of it tomorrow if I have time; otherwise, in the following days. I also have an issue with version management: to determine which version to fix based on the vulnerable version, I assumed the versions follow the x.x.x format, but they can be different. This is a topic I need to address. |
Thank you for working on this @4b75726169736859. I do have some concerns and a possible unpopular opinion. I've recently done some work in Dependency Track where I had to handle all the different version constraints that the Composer ecosystem supports, such as And that's just one ecosystem. The risk is that we add code to Defect Dojo that is not 100% correct and may select the wrong fix version. Wouldn't it be easier and safer to just list all the fixed version ranges and let the user decide to which version he or she wants to update? Everything we add to DD has to be maintained and should have testcases. Sometimes it's better to keep it simple. |
Glad to contribute to this project! I have the same concern. Previously, I made a version that lists all the fixed versions, and it’s already ready. It’s true that I won’t be able to maintain this indefinitely, as it takes a lot of time. I would have liked to bring this improvement to this parser. It’s late here, I will most likely push my second, simplified version tomorrow. |
Hi @4b75726169736859 I am going to close this out for right now, but please reopen it whenever you are ready 😄 |
@4b75726169736859 Thank you. Could you look at the Linting violations and update the unit tests to make them pass? |
Sure, no problem |
This pull request contains potential security risks related to information disclosure through detailed vulnerability descriptions and possible URL injection vulnerabilities in reference handling, which could provide attackers with system insights or opportunities for link manipulation. 💭 Unconfirmed Findings (2)
All finding details can be found in the DryRun Security Dashboard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you!
Description
This pull request enhances the
OSC Scan
parser by adding support for mitigation information, specifically the fixed versions of affected packages.Key Changes:
Extraction of Fixed Versions:
ranges
field within theaffected
section of each vulnerability.fixed
version from theevents
list when available and formatted it as:Upgrade to version: <fixed_version>
.Integration of Mitigation:
mitigation
field in findings to provide actionable guidance for resolving vulnerabilities.Enhanced Usability:
Testing Support:
Test Results
Testing was conducted using the provided sample JSON file (
test.json
). The parser correctly identifies findings and includes mitigation details in its output.Example Output:
CVE-2024-50252_linux
Medium
Upgrade to version: 6.1.119-1
Additionally, I verified that:
Although unit tests are planned to extend dojo/unittests, I was unable to complete them as I did not fully understand their functionality. However, I took screenshots of the final output to validate the results.
Documentation
The documentation has been updated to reflect this new feature:
Checklist
dev
branch.flake8
and Python 3.11 compliant.Labels
Import Scans
,enhancement
Extra Information
This pull request enhances the usability of the OSV parser, making it more actionable by including mitigation details. It also aligns with existing parsers, such as WPScan, which already support fixed versions, ensuring consistency across DefectDojo.
If you need further clarifications or adjustments, feel free to let me know!