From e335a161f8354251d623a0f7e1243918b3a08319 Mon Sep 17 00:00:00 2001 From: tdruez Date: Mon, 9 Dec 2024 18:53:01 +0400 Subject: [PATCH] Add `is_reachable` field on the VulnerabilityAnalysis model #103 Signed-off-by: tdruez --- CHANGELOG.rst | 5 ++++ dejacode/static/css/dejacode_bootstrap.css | 17 ++++++++---- .../tabs/tab_vulnerabilities.html | 9 +++++++ product_portfolio/views.py | 9 +++++++ vulnerabilities/api.py | 1 + vulnerabilities/filters.py | 12 +++++++++ vulnerabilities/forms.py | 3 ++- ...erabilityanalysis_is_reachable_and_more.py | 27 +++++++++++++++++++ vulnerabilities/models.py | 10 +++++++ 9 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 vulnerabilities/migrations/0005_vulnerabilityanalysis_is_reachable_and_more.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5f19d8b3..3bb1dc77 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -38,6 +38,11 @@ Release notes Add `risk_score` filter in Package endpoint. https://github.com/aboutcode-org/dejacode/issues/104 +- Add new `is_reachable` field on the VulnerabilityAnalysis model. + It can be used to declare if a this vulnerability is reachable, not reachable, or + if this fact is not known in the context of a Product Package. + https://github.com/aboutcode-org/dejacode/issues/103 + ### Version 5.2.1 - Fix the models documentation navigation. diff --git a/dejacode/static/css/dejacode_bootstrap.css b/dejacode/static/css/dejacode_bootstrap.css index f559cc68..34ef5908 100644 --- a/dejacode/static/css/dejacode_bootstrap.css +++ b/dejacode/static/css/dejacode_bootstrap.css @@ -388,16 +388,16 @@ table.vulnerabilities-table .column-summary { width: 210px; } #tab_vulnerabilities .column-affected_packages { - min-width: 300px; + min-width: 250px; } #tab_vulnerabilities .column-exploitability { - width: 155px; + width: 140px; } #tab_vulnerabilities .column-weighted_severity { - width: 120px; + width: 105px; } #tab_vulnerabilities .column-risk_score { - width: 90px; + width: 80px; } #tab_vulnerabilities .column-summary { width: 300px; @@ -411,6 +411,9 @@ table.vulnerabilities-table .column-summary { #tab_vulnerabilities .column-vulnerability_analyses__responses { min-width: 120px; } +#tab_vulnerabilities .column-vulnerability_analyses__is_reachable { + min-width: 80px; +} /* -- Vulnerability analysis modal -- */ #vulnerability-analysis-modal #div_id_responses .form-check { display: inline-block; @@ -655,11 +658,15 @@ td.sub-header { .table thead tr th a.sort:hover { color: #ccc; text-decoration: none; - margin-left: 0.0625rem; + margin-left: 0; } .table thead tr th a.sort.active { color: var(--bs-body-color); } +.tab-content .table thead tr th { + font-size: 0.875rem; +} +th a.sort i {width: auto;} /* -- Better looks for the popover fake links -- */ .tag_popover, diff --git a/product_portfolio/templates/product_portfolio/tabs/tab_vulnerabilities.html b/product_portfolio/templates/product_portfolio/tabs/tab_vulnerabilities.html index 9c712658..585b79c4 100644 --- a/product_portfolio/templates/product_portfolio/tabs/tab_vulnerabilities.html +++ b/product_portfolio/templates/product_portfolio/tabs/tab_vulnerabilities.html @@ -1,4 +1,6 @@ {% load i18n %} +{% load as_icon from dje_tags %} + {% include 'tabs/pagination.html' %} {% include 'includes/object_list_table_header.html' with filter=filterset include_actions=True %} @@ -72,6 +74,13 @@ {% endif %} +
+ {% if package.vulnerability_analysis.is_reachable %} + + {% elif package.vulnerability_analysis.is_reachable is False %} + + {% endif %} +