-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Udated Anchorectl_vuln parser to also parse Anchore Enterprise Vulnerability report #11688
base: dev
Are you sure you want to change the base?
Conversation
DryRun Security SummaryThe code changes enhance security scanning functionality through improved unit test coverage, support for new JSON formats, comprehensive vulnerability data handling, and better deduplication mechanisms in the vulnerability parsing system. Expand for full summarySummary: The provided code changes cover several updates to the unit tests and the vulnerability parsing functionality in the application. The key highlights from a security perspective are:
Files Changed:
Code AnalysisWe ran |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
@Maffooch Yes, it is a replacement for it. I see some checks were not successful. I will work on it and update this |
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.
Good work! The linter issues and failing tests need to be addressed, but otherwise good job integrating the new format while keeping the old format viable.
+ item["packageType"] | ||
+ ")" | ||
) | ||
metadata = data.get("metadata", {}) |
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.
Seems the old format has a list at the top level, and the .get() here is causing (the old) tests to fail. The data.get() two lines below will cause the same issue.
mitigation = ( | ||
"No fix available" + "\n" | ||
) | ||
mitigation = f"Upgrade to {vuln.get('fix', vuln.get('fixAvailable', 'No fix available'))}\n" |
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.
Not a problem per se, but wondering if the mitigation string "Upgrade to None" (in the case where no fix is available) is ideal.
@dogboat Thank you for the review. I will fix the linter issues and failing tests. |
I have added codes to update the current Anchorectl_vuln parser to also parse Anchore Enterprise Vulnerability report. This is the default json structure download via Anchore UI
Results
`(venv) josh@harbor:~/ANCHORE/defectDojo/django-DefectDojo-master$ python3 manage.py test unittests.tools.test_anchorectl_vulns_parser
System check identified no issues (0 silenced).
...
Ran 3 tests in 0.006s
OK
Destroying test database for alias 'default'...`