diff --git a/vulnerabilities/api_v3.py b/vulnerabilities/api_v3.py index fb85966a6..e0e180509 100644 --- a/vulnerabilities/api_v3.py +++ b/vulnerabilities/api_v3.py @@ -761,11 +761,11 @@ def get_affected_advisories_bulk(packages, max_advisories, base_url, reachabilit "exploitability": exploitability, "risk_score": risk_score, "fixed_by_packages": fixed_by_packages, - "introduced_in_patch": introduced_patches_by_set.get( + "introduced_in_patches": introduced_patches_by_set.get( adv.id, [], ), - "fixed_in_patch": fixed_patches_by_set.get( + "fixed_in_patches": fixed_patches_by_set.get( adv.id, [], ), @@ -864,8 +864,8 @@ def get_affected_advisories_bulk(packages, max_advisories, base_url, reachabilit "exploitability": advisory.exploitability, "risk_score": advisory.risk_score, "fixed_by_packages": fixed_by_packages, - "introduced_in_patch": introduced_patches_by_set.get(advisory_id, []), - "fixed_in_patch": introduced_patches_by_set.get(advisory_id, []), + "introduced_in_patches": introduced_patches_by_set.get(advisory_id, []), + "fixed_in_patches": introduced_patches_by_set.get(advisory_id, []), "ssvc_trees": [ { "vector": ssvc.vector, diff --git a/vulnerabilities/tests/test_api_v3.py b/vulnerabilities/tests/test_api_v3.py index c8bb7e31d..bde17af15 100644 --- a/vulnerabilities/tests/test_api_v3.py +++ b/vulnerabilities/tests/test_api_v3.py @@ -330,14 +330,14 @@ def test_packages_commit_patch(self): advisory_data = vulns[0] assert advisory_data["advisory_id"] == "AVID-123" - assert advisory_data["introduced_in_patch"] == [ + assert advisory_data["introduced_in_patches"] == [ { "commit_hash": "06580c7f99c6fde7bcf18e30bdcc61f081430957", "vcs_url": "https://github.com/aboutcode-org/sample", } ] - assert advisory_data["fixed_in_patch"] == [ + assert advisory_data["fixed_in_patches"] == [ { "commit_hash": "98e516011d6e096e25247b82fc5f196bbeecff10", "vcs_url": "https://github.com/aboutcode-org/sample", @@ -450,7 +450,7 @@ def test_packages_commit_patch(self): assert { "commit_hash": "06580c7f99c6fde7bcf18e30bdcc61f081430957", "vcs_url": "https://github.com/aboutcode-org/sample", - } in advisory_data["introduced_in_patch"] + } in advisory_data["introduced_in_patches"] def test_advisory_set_member_patches_aggregation(self): url = reverse("package-v3-list") @@ -472,10 +472,12 @@ def test_advisory_set_member_patches_aggregation(self): advisory_data = vulns[0] assert advisory_data["advisory_id"] == "AVID-123" - introduced_hashes = [patch["commit_hash"] for patch in advisory_data["introduced_in_patch"]] + introduced_hashes = [ + patch["commit_hash"] for patch in advisory_data["introduced_in_patches"] + ] assert "06580c7f99c6fde7bcf18e30bdcc61f081430957" in introduced_hashes assert "98e516011d6e096e25247b82fc5f196bbeecff10" in introduced_hashes - fixed_hashes = [patch["commit_hash"] for patch in advisory_data["fixed_in_patch"]] + fixed_hashes = [patch["commit_hash"] for patch in advisory_data["fixed_in_patches"]] assert "98e516011d6e096e25247b82fc5f196bbeecff10" in fixed_hashes assert "2fc5f196bbeecff1098e516011d6e096e25247b8" in fixed_hashes