Skip to content

Commit 67e9c6c

Browse files
committed
Update the pipeline to use the new AdvisoryDataV2
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 81933a5 commit 67e9c6c

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

vulnerabilities/pipes/vcs_collector_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from packageurl.contrib.purl2url import purl2url
1818
from packageurl.contrib.url2purl import url2purl
1919

20-
from vulnerabilities.importer import AdvisoryData
20+
from vulnerabilities.importer import AdvisoryDataV2
2121
from vulnerabilities.importer import AffectedPackageV2
2222
from vulnerabilities.importer import PackageCommitPatchData
2323
from vulnerabilities.importer import ReferenceV2
@@ -135,11 +135,11 @@ def collect_advisories(self):
135135
)
136136
)
137137

138-
yield AdvisoryData(
138+
yield AdvisoryDataV2(
139139
advisory_id=vuln_id,
140140
summary=summary,
141141
affected_packages=affected_packages,
142-
references_v2=references,
142+
references=references,
143143
url=self.repo_url,
144144
)
145145

vulnerabilities/tests/pipelines/v2_importers/test_collect_fix_commit.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ class DummyCommit:
4040
def test_collect_fix_commits_groups_by_vuln(mock_repo, pipeline):
4141
commit1 = MagicMock(message="Fix CVE-2021-0001", hexsha="abc123")
4242
commit2 = MagicMock(message="Patch GHSA-f72r-2h5j-7639", hexsha="def456")
43-
commit3 = MagicMock(message="Unrelated change", hexsha="ghi789")
43+
commit3 = MagicMock(
44+
message="Patch GHSA-5w93-4g67-mm43", hexsha="Github Advisory: GHSA-5w93-4g67-mm43"
45+
)
46+
commit4 = MagicMock(message="Unrelated change", hexsha="ghi789")
4447

4548
pipeline.repo = MagicMock()
46-
pipeline.repo.iter_commits.return_value = [commit1, commit2, commit3]
49+
pipeline.repo.iter_commits.return_value = [commit1, commit2, commit3, commit4]
4750

4851
pipeline.classify_commit_type = MagicMock(
4952
side_effect=lambda c: (
@@ -59,6 +62,9 @@ def test_collect_fix_commits_groups_by_vuln(mock_repo, pipeline):
5962

6063
expected = {
6164
"CVE-2021-0001": [("abc123", "Fix CVE-2021-0001")],
65+
"GHSA-5w93-4g67-mm43": [
66+
("Github Advisory: GHSA-5w93-4g67-mm43", "Patch GHSA-5w93-4g67-mm43")
67+
],
6268
"GHSA-f72r-2h5j-7639": [("def456", "Patch GHSA-f72r-2h5j-7639")],
6369
}
6470

vulnerabilities/tests/test_data/fix_commits/expected_linux_advisory_output.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
]
2727
}
2828
],
29-
"references_v2": [
29+
"references": [
3030
{
3131
"reference_id": "41b43c74bda19753c757036673ea9db74acf494a",
3232
"reference_type": "commit",
@@ -66,7 +66,7 @@
6666
]
6767
}
6868
],
69-
"references_v2": [
69+
"references": [
7070
{
7171
"reference_id": "49ff1042aa66bb25eda87e9a8ef82f3b0ad4eeba",
7272
"reference_type": "commit",

0 commit comments

Comments
 (0)