Skip to content

Commit 0b5d153

Browse files
committed
display the highest ssvc decision in vulnerability popover
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 08e715c commit 0b5d153

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

component_catalog/templates/component_catalog/includes/vulnerability_info_popover.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<div class='mb-1'><strong>Exploitability:</strong> {{ vulnerability.get_exploitability_display }}</div>
3030
{% endif %}
3131
{% if vulnerability.risk_score %}
32-
<div><strong>Risk:</strong> {{ vulnerability.risk_score }}</div>
32+
<div class='mb-1'><strong>Risk:</strong> {{ vulnerability.risk_score }}</div>
33+
{% endif %}
34+
{% if vulnerability.highest_ssvc_decision %}
35+
<div><strong>SSVC:</strong> {{ vulnerability.highest_ssvc_decision }}</div>
3336
{% endif %}
3437
</div>

vulnerabilities/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ def cve(self):
208208
if alias.startswith("CVE-"):
209209
return alias
210210

211+
@property
212+
def highest_ssvc_decision(self):
213+
"""Return the most severe SSVC decision among this vulnerability's published trees."""
214+
decisions = {tree.get("decision") for tree in self.ssvc_trees}
215+
for decision in ("Act", "Attend", "Track*", "Track"):
216+
if decision in decisions:
217+
return decision
218+
211219
def add_affected(self, instances, update_score=True):
212220
"""Assign the ``instances`` (Package or Product) as affected by this vulnerability."""
213221
if not isinstance(instances, (list, tuple, models.QuerySet)):

0 commit comments

Comments
 (0)