Skip to content

Commit ae4abd8

Browse files
committed
Do not report ghost packages as fix for vulnerabilities in UI
Signed-off-by: Keshav Priyadarshi <[email protected]>
1 parent dc2b367 commit ae4abd8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

vulnerabilities/views.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ def get_context_data(self, **kwargs):
119119
package = self.object
120120
context["package"] = package
121121
context["affected_by_vulnerabilities"] = package.affected_by.order_by("vulnerability_id")
122-
context["fixing_vulnerabilities"] = package.fixing.order_by("vulnerability_id")
122+
# Ghost package should not fix any vulnerability.
123+
context["fixing_vulnerabilities"] = (
124+
None if package.is_ghost else package.fixing.order_by("vulnerability_id")
125+
)
123126
context["package_search_form"] = PackageSearchForm(self.request.GET)
124127
context["fixed_package_details"] = package.fixed_package_details
125128

@@ -193,6 +196,11 @@ def get_context_data(self, **kwargs):
193196
affected_fixed_by_matches["affected_package"] = sorted_affected_package
194197
matched_fixed_by_packages = []
195198
for fixed_by_package in sorted_fixed_by_packages:
199+
200+
# Ghost Package can't fix vulnerability.
201+
if fixed_by_package.is_ghost:
202+
continue
203+
196204
sorted_affected_version_class = get_purl_version_class(sorted_affected_package)
197205
fixed_by_version_class = get_purl_version_class(fixed_by_package)
198206
if (

0 commit comments

Comments
 (0)