From e1b0b46dad38c84ceec4b61f094b61c0e043256d Mon Sep 17 00:00:00 2001 From: MariaPaula Trujillo Date: Thu, 4 Jan 2024 15:11:48 +0100 Subject: [PATCH 01/10] Switch to cve cards --- templates/security/cve/_cve-card.html | 67 ++++++++++++ templates/security/cve/index.html | 147 +++++++++----------------- webapp/security/views.py | 20 ++-- 3 files changed, 131 insertions(+), 103 deletions(-) create mode 100644 templates/security/cve/_cve-card.html diff --git a/templates/security/cve/_cve-card.html b/templates/security/cve/_cve-card.html new file mode 100644 index 00000000000..a5e702b5a97 --- /dev/null +++ b/templates/security/cve/_cve-card.html @@ -0,0 +1,67 @@ +{% for cve in cves %} +
+
+
+

+ {{ cve.id }} + + {% if cve.priority == 'unknown' %} + + {% elif cve.priority == 'negligible' %} + + {% elif cve.priority == 'low' %} + + {% elif cve.priority == 'medium' %} + + {% elif cve.priority == 'high' %} + + {% elif cve.priority == 'critical' %} + + {% else %} + + {% endif %} + {{ cve.priority.split() | first | capitalize }} priority + +

+
+
+
+ {% set status = cve.summarized_status %} + {% if status.name == "Some fixed" %} +

Some fixes available {{ status.fixed_count }} of {{ status.total_count }}

+ {% elif status.name == "Needs evaluation" %} +

+ Needs evaluation +

+ {% endif %} +

+
+
+
+
+

{{ cve.description }}

+
+
+

{{ cve.packages | length}} affected packages

+

+ {% for package in cve.packages %} + {% if cve.packages | length > 6 %} + {% if loop.index < 6 %} + {{ package.name }}, + {% elif loop.index == 6 %} + and {{ cve.packages | length - 5 }} more + {% endif %} + {% else %} + {% if loop.last %} + {{ package.name }} + {% else %} + {{ package.name }}, + {% endif %} + {% endif %} + {% endfor %} +

+
+ {% if loop.index < 5 %} +
+ {% endif %} +{% endfor %} \ No newline at end of file diff --git a/templates/security/cve/index.html b/templates/security/cve/index.html index 2b16003d73e..951dea14f13 100644 --- a/templates/security/cve/index.html +++ b/templates/security/cve/index.html @@ -15,7 +15,7 @@
{% if query or package or component or priority or versions or statuses %} -

CVE reports

+

Search CVE reports

{% else %}

CVE reports

The Common Vulnerabilities and Exposures (CVE) system is used to identify, define, and catalog publicly disclosed cybersecurity vulnerabilities. Canonical keeps track of all CVEs affecting Ubuntu, and releases a security notice when an issue is fixed.

@@ -90,109 +90,66 @@

By Ubuntu release

Recent CVEs

- {% for cve in high_priority_cves %} -
-
-
-

- {{ cve.id }} - - {% if cve.priority == 'unknown' %} - - {% elif cve.priority == 'negligible' %} - - {% elif cve.priority == 'low' %} - - {% elif cve.priority == 'medium' %} - - {% elif cve.priority == 'high' %} - - {% elif cve.priority == 'critical' %} - + {% with cves = high_priority_cves %} + {% include "security/cve/_cve-card.html" %} + {% endwith %} +

+
+ + +
+
+
+ +
+ + {% if total_results > 0 %} +
+
+
+

+ {% if total_results > 1 %} + {{ offset + 1 }} + – + {% if offset + limit > total_results %} + {{ total_results }} {% else %} - + {{ offset + limit }} {% endif %} - {{ cve.priority.split() | first | capitalize }} priority - + of + {% endif %} + {{ total_results }} result{% if total_results != 1 %}s{% endif %}

+
+ +
+ + +
+ +
-
- {% set status = cve.summarized_status %} - {% if status.name == "Some fixed" %} -

Some fixes available {{ status.fixed_count }} of {{ status.total_count }}

- {% elif status.name == "Needs evaluation" %} -

- Needs evaluation -

- {% endif %} -

-
-
-
-
-

{{ cve.description }}

-
-
-

{{ cve.packages | length}} affected packages

-

- {% for package in cve.packages %} - {% if cve.packages | length > 6 %} - {% if loop.index < 6 %} - {{ package.name }}, - {% elif loop.index == 6 %} - and {{ cve.packages | length - 5 }} more - {% endif %} - {% else %} - {% if loop.last %} - {{ package.name }} - {% else %} - {{ package.name }}, - {% endif %} - {% endif %} - {% endfor %} -

+
+ {% with cves = cves%} + {% include "security/cve/_cve-card.html" %} + {% endwith %} + + {% with %} + {% include "security/cve/_pagination.html" %} + {% endwith %}
- {% if loop.index < 5 %} -
- {% endif %} - {% endfor %} -
-
- - -
-
- {% if query or package or priority %} -

- {% if total_results > 1 %} - {{ offset + 1 }} - – - {% if offset + limit > total_results %} - {{ total_results }} - {% else %} - {{ offset + limit }} - {% endif %} - of - {% endif %} - {{ total_results }} result{% if total_results != 1 %}s{% endif %} -

- {% else %} -

Recent CVEs affecting Ubuntu

{% endif %}
- {% if total_results > 0 %} -
- {% with cves=cves, releases=releases %} - {% include "security/cve/_cve-table.html" %} - {% endwith %} - - {% with %} - {% include "security/cve/_pagination.html" %} - {% endwith %} -
- {% endif %} +