From dcd2f00a328e4a1f426c56418ca08f5d50f4415c Mon Sep 17 00:00:00 2001 From: ziad hany Date: Sat, 16 Aug 2025 23:07:09 +0300 Subject: [PATCH 1/2] Fix EPSS tab to show latest published data instead of old entries Signed-off-by: ziad hany --- vulnerabilities/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vulnerabilities/views.py b/vulnerabilities/views.py index f4cd99dbe..8accf06bb 100644 --- a/vulnerabilities/views.py +++ b/vulnerabilities/views.py @@ -328,7 +328,10 @@ def get_context_data(self, **kwargs): ): logging.error(f"CVSSMalformedError for {severity.scoring_elements}") - epss_severity = vulnerability.severities.filter(scoring_system="epss").first() + epss_severity = vulnerability.severities.filter(scoring_system="epss").latest( + "published_at" + ) + epss_data = None if epss_severity: epss_data = { From bf80cc165d88e6dd20e71d819bfab0addc44cc51 Mon Sep 17 00:00:00 2001 From: ziad hany Date: Sun, 17 Aug 2025 22:39:06 +0300 Subject: [PATCH 2/2] Split severities into EPSS and non-EPSS sections Signed-off-by: ziad hany --- .../templates/vulnerability_details.html | 140 +++++++++++------- vulnerabilities/views.py | 32 ++-- 2 files changed, 99 insertions(+), 73 deletions(-) diff --git a/vulnerabilities/templates/vulnerability_details.html b/vulnerabilities/templates/vulnerability_details.html index 7001c8f3b..0ded8ed31 100644 --- a/vulnerabilities/templates/vulnerability_details.html +++ b/vulnerabilities/templates/vulnerability_details.html @@ -68,7 +68,7 @@
  • - EPSS + EPSS ({{ epss_severities|length }})
  • @@ -501,13 +501,15 @@ {% endfor %} - - +
    - {% if epss_data %} + + {% if epss_severities %}
    Exploit Prediction Scoring System (EPSS)
    + + {% with first=epss_severities.0 %} @@ -517,7 +519,7 @@ Percentile - + - + - {% if epss_data.published_at %} - + - {% endif %}
    {{ epss_data.percentile }}{{ first.scoring_elements }}
    @@ -526,9 +528,8 @@ EPSS Score {{ epss_data.score }}{{ first.value }}
    {{ epss_data.published_at }}{{ first.published_at }}
    - {% else %} -

    No EPSS data available for this vulnerability.

    - {% endif %} -
    + {% endwith %} -
    - - +
    + EPSS History +
    + +
    + + + + + + + {% for epss_severity in epss_severities %} + + + + + + + {% endfor %} +
    Score Percentile Published At Found at
    {{ epss_severity.value }}{{ epss_severity.scoring_elements }}{{ epss_severity.published_at }} + + {{ epss_severity.url }} + + +
    + {% else %} - - - Date - - - Actor - - Action - Source - - VulnerableCode Version - + + No EPSS data available for this vulnerability. + - - {% for log in history %} - - {{ log.get_iso_time }} - {{ log.actor_name }} - {{ log.get_action_type_label }} - {{log.source_url }} - {{ log.software_version }} - - {% empty %} - - - There are no relevant records. - - - {% endfor %} - + {% endif %}
    +
    + + + + + + + + + + + {% for log in history %} + + + + + + + + {% empty %} + + + + {% endfor %} +
    + + Date + + Actor + Action Source + VulnerableCode Version +
    {{ log.get_iso_time }}{{ log.actor_name }}{{ log.get_action_type_label }} {{log.source_url }} {{ log.software_version }}
    + There are no relevant records. +
    +
    diff --git a/vulnerabilities/views.py b/vulnerabilities/views.py index 8accf06bb..758b58970 100644 --- a/vulnerabilities/views.py +++ b/vulnerabilities/views.py @@ -7,6 +7,7 @@ # See https://aboutcode.org for more information about nexB OSS projects. # import logging +from datetime import datetime from cvss.exceptions import CVSS2MalformedError from cvss.exceptions import CVSS3MalformedError @@ -305,12 +306,19 @@ def get_context_data(self, **kwargs): if weakness_object.weakness ] - valid_severities = self.object.severities.exclude(scoring_system=EPSS.identifier).filter( - scoring_elements__isnull=False, scoring_system__in=SCORING_SYSTEMS.keys() - ) + all_severities = list(self.object.severities.all().order_by("-published_at")) - severity_vectors = [] + valid_severities = [ + s + for s in all_severities + if s.scoring_system != EPSS.identifier + and s.scoring_elements is not None + and s.scoring_system in SCORING_SYSTEMS + ] + epss_severities = [s for s in all_severities if s.scoring_system == EPSS.identifier] + + severity_vectors = [] for severity in valid_severities: try: vector_values_system = SCORING_SYSTEMS[severity.scoring_system] @@ -328,30 +336,18 @@ def get_context_data(self, **kwargs): ): logging.error(f"CVSSMalformedError for {severity.scoring_elements}") - epss_severity = vulnerability.severities.filter(scoring_system="epss").latest( - "published_at" - ) - - epss_data = None - if epss_severity: - epss_data = { - "percentile": epss_severity.scoring_elements, - "score": epss_severity.value, - "published_at": epss_severity.published_at, - } - context.update( { "vulnerability": vulnerability, "vulnerability_search_form": VulnerabilitySearchForm(self.request.GET), - "severities": list(vulnerability.severities.all()), + "severities": list(self.object.severities.exclude(scoring_system=EPSS.identifier)), "severity_vectors": severity_vectors, + "epss_severities": epss_severities, "references": list(vulnerability.references.all()), "aliases": list(vulnerability.aliases.all()), "weaknesses": weaknesses_present_in_db, "status": vulnerability.get_status_label, "history": vulnerability.history, - "epss_data": epss_data, } ) return context