-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Dependency Track parser: Store DT uuid into unique_id_from_tool instead of vuln_id_from_tool #14346
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -197,7 +197,7 @@ def _convert_dependency_track_finding_to_dojo_finding(self, dependency_track_fin | |||||||
| if "description" in dependency_track_finding["vulnerability"] and dependency_track_finding["vulnerability"]["description"] is not None: | ||||||||
| vulnerability_description += "\nVulnerability Description: {description}".format(description=dependency_track_finding["vulnerability"]["description"]) | ||||||||
| if "uuid" in dependency_track_finding["vulnerability"] and dependency_track_finding["vulnerability"]["uuid"] is not None: | ||||||||
| vuln_id_from_tool = dependency_track_finding["vulnerability"]["uuid"] | ||||||||
| unique_id_from_tool = dependency_track_finding["vulnerability"]["uuid"] | ||||||||
|
|
||||||||
| # Get severity according to Dependency Track and convert it to a severity DefectDojo understands | ||||||||
| dependency_track_severity = dependency_track_finding["vulnerability"]["severity"] | ||||||||
|
|
@@ -229,7 +229,7 @@ def _convert_dependency_track_finding_to_dojo_finding(self, dependency_track_fin | |||||||
| component_name=component_name, | ||||||||
| component_version=component_version, | ||||||||
| file_path=file_path, | ||||||||
| vuln_id_from_tool=vuln_id_from_tool, | ||||||||
| unique_id_from_tool=unique_id_from_tool, | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| static_finding=True, | ||||||||
| dynamic_finding=False) | ||||||||
|
|
||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,7 @@ def test_dependency_track_parser_has_many_findings(self): | |||||||
| self.assertIsNone(findings[1].unsaved_vulnerability_ids) | ||||||||
| self.assertEqual(1, len(findings[2].unsaved_vulnerability_ids)) | ||||||||
| self.assertEqual("CVE-2016-2097", findings[2].unsaved_vulnerability_ids[0]) | ||||||||
| self.assertEqual("900991f6-335a-49cb-9bf6-87b545f960ce", findings[2].unique_id_from_tool) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| self.assertTrue(findings[2].false_p) | ||||||||
| self.assertTrue(findings[2].is_mitigated) | ||||||||
| self.assertFalse(findings[2].active) | ||||||||
|
|
@@ -63,7 +64,7 @@ def test_dependency_track_parser_v3_8_0(self): | |||||||
| findings = parser.get_findings(testfile, Test()) | ||||||||
| self.assertEqual(9, len(findings)) | ||||||||
| self.assertTrue(all(item.file_path is not None for item in findings)) | ||||||||
| self.assertTrue(all(item.vuln_id_from_tool is not None for item in findings)) | ||||||||
| self.assertTrue(all(item.unique_id_from_tool is not None for item in findings)) | ||||||||
|
|
||||||||
| def test_dependency_track_parser_findings_with_alias(self): | ||||||||
| with ( | ||||||||
|
|
@@ -74,8 +75,10 @@ def test_dependency_track_parser_findings_with_alias(self): | |||||||
|
|
||||||||
| self.assertEqual(12, len(findings)) | ||||||||
| self.assertTrue(all(item.file_path is not None for item in findings)) | ||||||||
| self.assertTrue(all(item.vuln_id_from_tool is not None for item in findings)) | ||||||||
| self.assertTrue(all(item.unique_id_from_tool is not None for item in findings)) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| self.assertIn("CVE-2022-42004", findings[0].unsaved_vulnerability_ids) | ||||||||
| self.assertIn("DSA-5283-1", findings[0].unsaved_vulnerability_ids) | ||||||||
| self.assertIn("GHSA-rgv9-q543-rqg4", findings[0].unsaved_vulnerability_ids) | ||||||||
|
|
||||||||
| def test_dependency_track_parser_findings_with_empty_alias(self): | ||||||||
| with ( | ||||||||
|
|
@@ -93,7 +96,7 @@ def test_dependency_track_parser_findings_with_cvssV3_score(self): | |||||||
| findings = parser.get_findings(testfile, Test()) | ||||||||
| self.assertEqual(12, len(findings)) | ||||||||
| self.assertTrue(all(item.file_path is not None for item in findings)) | ||||||||
| self.assertTrue(all(item.vuln_id_from_tool is not None for item in findings)) | ||||||||
| self.assertTrue(all(item.unique_id_from_tool is not None for item in findings)) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| self.assertIn("CVE-2022-42004", findings[0].unsaved_vulnerability_ids) | ||||||||
| self.assertEqual(8.3, findings[0].cvssv3_score) | ||||||||
|
|
||||||||
|
|
||||||||
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.