From ca23847c72610c11aa5f3648c966aba3bfab7de8 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 20 Nov 2024 13:53:25 +0530 Subject: [PATCH 1/3] Add scores in bulk search V1 API Signed-off-by: Tushar Goel --- vulnerabilities/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vulnerabilities/api.py b/vulnerabilities/api.py index 18c5f3cb2..3a99c9c38 100644 --- a/vulnerabilities/api.py +++ b/vulnerabilities/api.py @@ -177,7 +177,7 @@ def get_references(self, vulnerability): class Meta: model = Vulnerability - fields = ["url", "vulnerability_id", "summary", "references", "fixed_packages", "aliases"] + fields = ["url", "vulnerability_id", "summary", "references", "fixed_packages", "aliases", "risk_score", "exploitability", "weighted_severity"] class WeaknessSerializer(serializers.HyperlinkedModelSerializer): From dc19883e9130dcf54183fc861501d6413b96a4ac Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 20 Nov 2024 13:54:02 +0530 Subject: [PATCH 2/3] Fix formatting Signed-off-by: Tushar Goel --- vulnerabilities/api.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vulnerabilities/api.py b/vulnerabilities/api.py index 3a99c9c38..285ccea79 100644 --- a/vulnerabilities/api.py +++ b/vulnerabilities/api.py @@ -177,7 +177,17 @@ def get_references(self, vulnerability): class Meta: model = Vulnerability - fields = ["url", "vulnerability_id", "summary", "references", "fixed_packages", "aliases", "risk_score", "exploitability", "weighted_severity"] + fields = [ + "url", + "vulnerability_id", + "summary", + "references", + "fixed_packages", + "aliases", + "risk_score", + "exploitability", + "weighted_severity", + ] class WeaknessSerializer(serializers.HyperlinkedModelSerializer): From a03d01b9ab608346fc367336f00aff854490fc6a Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 20 Nov 2024 14:01:43 +0530 Subject: [PATCH 3/3] Fix tests Signed-off-by: Tushar Goel --- vulnerabilities/tests/test_api.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vulnerabilities/tests/test_api.py b/vulnerabilities/tests/test_api.py index 1ded8c824..06ae64fcb 100644 --- a/vulnerabilities/tests/test_api.py +++ b/vulnerabilities/tests/test_api.py @@ -636,6 +636,9 @@ def test_api_with_lesser_and_greater_fixed_by_packages(self): } ], "aliases": ["CVE-2020-36518", "GHSA-57j2-w4cx-62h2"], + "risk_score": None, + "exploitability": None, + "weighted_severity": None, "resource_url": "http://testserver/vulnerabilities/VCID-vul1-vul1-vul1", } ], @@ -678,6 +681,9 @@ def test_api_with_lesser_and_greater_fixed_by_packages(self): }, ], "aliases": ["CVE-2021-46877", "GHSA-3x8x-79m2-3w2w"], + "risk_score": None, + "exploitability": None, + "weighted_severity": None, "resource_url": "http://testserver/vulnerabilities/VCID-vul3-vul3-vul3", } ],