Skip to content

Commit d40ffa0

Browse files
committed
Handle packages which are subject of more than 100 advisories
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 1d2aaee commit d40ffa0

File tree

4 files changed

+348
-109
lines changed

4 files changed

+348
-109
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{% extends "base.html" %}
2+
{% load humanize %}
3+
{% load widget_tweaks %}
4+
{% load static %}
5+
{% load url_filters %}
6+
{% load utils %}
7+
8+
{% block content %}
9+
<div class="is-max-desktop mb-3">
10+
<section class="mx-5">
11+
<div class="is-flex" style="justify-content: space-between;">
12+
<div>
13+
{{ page_obj.paginator.count|intcomma }} results
14+
</div>
15+
{% if is_paginated %}
16+
{% include 'includes/pagination.html' with page_obj=page_obj %}
17+
{% endif %}
18+
</div>
19+
</section>
20+
</div>
21+
22+
<section class="section pt-0">
23+
<div class="content">
24+
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
25+
<thead>
26+
<tr>
27+
<th style="width: 200px;">Advisory</th>
28+
<th style="width: 310px;">Source</th>
29+
<th style="width: 200px;">Date Published</th>
30+
<th>Summary</th>
31+
<th style="width: 310px;">Fixed in package version</th>
32+
</tr>
33+
</thead>
34+
35+
<tbody>
36+
{% for advisory in page_obj %}
37+
<tr>
38+
<td>
39+
<a href="{{advisory.get_absolute_url}}">
40+
{{advisory.avid }}
41+
</a>
42+
<br />
43+
{% if advisory.alias|length != 0 %}
44+
Aliases:
45+
{% endif %}
46+
<br />
47+
{% for alias in advisory.alias %}
48+
{% if alias.url %}
49+
<a href="{{ alias.url }}" target="_blank">{{ alias }}<i
50+
class="fa fa-external-link fa_link_custom"></i></a>
51+
<br />
52+
{% else %}
53+
{{ alias }}
54+
<br />
55+
{% endif %}
56+
{% endfor %}
57+
58+
{% if advisory.secondary|length != 0 %}
59+
<p>Supporting advisories are listed below the primary advisory.</p>
60+
{% for secondary in advisory.secondary %}
61+
<a href="{{secondary.get_absolute_url}}">
62+
{{secondary.avid }}
63+
</a>
64+
{% endfor %}
65+
{% endif %}
66+
</td>
67+
<td style="word-wrap: break-word; word-break: break-word;">
68+
<a href={{advisory.url}} target="_blank">{{advisory.url}}</a>
69+
</td>
70+
<td style="word-wrap: break-word; word-break: break-word;">
71+
{{advisory.date_published}}
72+
</td>
73+
<td style="word-wrap: break-word; word-break: break-word;">
74+
{{ advisory.summary }}
75+
</td>
76+
<td style="word-wrap: break-word; word-break: break-all;">
77+
{% with fixed=fixed_package_details|get_item:advisory.avid %}
78+
{% if fixed %}
79+
{% for item in fixed %}
80+
<section>
81+
<a href="/packages/v2/{{ item.pkg.purl|url_quote }}?search={{ item.pkg.purl }}"
82+
target="_self">{{ item.pkg.version }}</a>
83+
<br/>
84+
{% if item.pkg.is_vulnerable %}
85+
<span class="{{ item.pkg.is_vulnerable|yesno:'emphasis-vulnerable,emphasis-not-vulnerable' }}">
86+
Vulnerable
87+
</span>
88+
{% else %}
89+
<span class="{{ item.pkg.is_vulnerable|yesno:'emphasis-vulnerable,emphasis-not-vulnerable' }}">
90+
Not vulnerable
91+
</span>
92+
{% endif %}
93+
</section>
94+
{% endfor %}
95+
{% else %}
96+
<span class="emphasis-vulnerable">There are no reported fixed by versions.</span>
97+
{% endif %}
98+
{% endwith %}
99+
</td>
100+
</tr>
101+
{% empty %}
102+
<tr>
103+
<td colspan="3">
104+
<span class="emphasis-not-vulnerable">This package is not known to be subject of any advisories.</span>
105+
</td>
106+
</tr>
107+
{% endfor %}
108+
</tbody>
109+
</table>
110+
</div>
111+
112+
{% if is_paginated %}
113+
{% include 'includes/pagination.html' with page_obj=page_obj %}
114+
{% endif %}
115+
{% endblock %}
116+
</section>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{% extends "base.html" %}
2+
{% load humanize %}
3+
{% load widget_tweaks %}
4+
5+
{% block content %}
6+
<div class="is-max-desktop mb-3">
7+
<section class="mx-5">
8+
<div class="is-flex" style="justify-content: space-between;">
9+
<div>
10+
{{ page_obj.paginator.count|intcomma }} results
11+
</div>
12+
{% if is_paginated %}
13+
{% include 'includes/pagination.html' with page_obj=page_obj %}
14+
{% endif %}
15+
</div>
16+
</section>
17+
</div>
18+
19+
<section class="section pt-0">
20+
<div class="content">
21+
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
22+
<thead>
23+
<tr>
24+
<th style="width: 200px;">Advisory</th>
25+
<th style="width: 225px;">Source</th>
26+
<th style="width: 225px;">Date Published</th>
27+
<th>Summary</th>
28+
<th style="width: 225px;">Aliases</th>
29+
</tr>
30+
</thead>
31+
<tbody>
32+
{% for advisory in page_obj %}
33+
<tr>
34+
<td>
35+
<a href="{{advisory.get_absolute_url}}">
36+
{{advisory.avid }}
37+
</a>
38+
</td>
39+
<td>
40+
<a href={{advisory.url}} target="_blank">{{advisory.url}}</a>
41+
</td>
42+
<td>
43+
{{advisory.date_published}}
44+
</td>
45+
<td>
46+
{{ advisory.summary }}
47+
</td>
48+
<td>
49+
{% for alias in advisory.alias %}
50+
{% if alias.url %}
51+
<a href="{{ alias.url }}" target="_blank">{{ alias }}<i
52+
class="fa fa-external-link fa_link_custom"></i></a>
53+
<br />
54+
{% else %}
55+
{{ alias }}
56+
<br />
57+
{% endif %}
58+
{% endfor %}
59+
</td>
60+
</tr>
61+
{% empty %}
62+
<tr>
63+
<td colspan="3">
64+
This package is not known to fix any advisories.
65+
</td>
66+
</tr>
67+
{% endfor %}
68+
</tbody>
69+
</table>
70+
</div>
71+
72+
{% if is_paginated %}
73+
{% include 'includes/pagination.html' with page_obj=page_obj %}
74+
{% endif %}
75+
{% endblock %}
76+
</section>

vulnerabilities/templates/package_details_v2.html

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<div id="tab-content">
4646
<div class="tab-div is-active" data-content="essentials">
4747
<div class="tab-nested-div mb-1 pb-0">
48-
{% if affected_by_advisories_v2|length != 0 %}
48+
{% if affected_by_advisories_v2|length != 0 or affected_by_advisories_v2_url %}
4949
<div class="pl-3 pr-3 mb-5 floating-purl pb-0">
5050
{% else %}
5151
<div class="pl-3 pr-3 mb-5 floating-purl pb-2">
@@ -82,7 +82,7 @@
8282
</tbody>
8383
</table>
8484
</div>
85-
{% if affected_by_advisories_v2|length != 0 %}
85+
{% if affected_by_advisories_v2|length != 0 or affected_by_advisories_v2_url %}
8686

8787
<div class="pl-3 pr-3 mb-6 non-vuln pb-0">
8888
<table class="table vcio-table width-100-pct">
@@ -128,10 +128,10 @@
128128
{% endif %}
129129

130130
<div class="content ml-3 mr-3 pb-1">
131+
{% if affected_by_advisories_v2|length != 0 %}
131132
<div class="has-text-weight-bold ml-1 mb-0 pb-0">
132133
Vulnerabilities affecting this package ({{ affected_by_advisories_v2|length }})
133134
</div>
134-
135135
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
136136
<thead>
137137
<tr>
@@ -218,9 +218,20 @@
218218
{% endfor %}
219219
</tbody>
220220
</table>
221+
{% elif affected_by_advisories_v2_url %}
222+
<div class="has-text-weight-bold ml-1 mb-0 pb-0">
223+
This package is subject to more than 100 advisories. Please refer to the following
224+
URL for vulnerabilities affecting this package: <a href="{{ affected_by_advisories_v2_url }}" target="_blank"> Advisories </a>
225+
</div>
226+
{% else %}
227+
<div class="has-text-weight-bold ml-1 mb-0 pb-0">
228+
This package is not known to be subject of any advisories.
229+
</div>
230+
{% endif %}
221231
</div>
222232

223233
<div class="content ml-3 mr-3 pb-0 mb-0">
234+
{% if fixing_advisories_v2|length != 0 %}
224235
<div class="has-text-weight-bold ml-1 mb-0 pb-0">
225236
Vulnerabilities fixed by this package ({{ fixing_advisories_v2|length }})
226237
</div>
@@ -285,6 +296,16 @@
285296
</table>
286297

287298
<br />
299+
{% elif fixing_advisories_v2_url %}
300+
<div class="has-text-weight-bold ml-1 mb-0 pb-0">
301+
This package is known to fix more than 100 advisories. Please refer to the following
302+
URL for vulnerabilities fixed by this package: <a href="{{ fixing_advisories_v2_url }}" target="_blank"> Advisories </a>
303+
</div>
304+
{% else %}
305+
<div class="has-text-weight-bold ml-1 mb-0 pb-0">
306+
This package is not known to fix any advisories.
307+
</div>
308+
{% endif %}
288309
</div>
289310
</div>
290311
</div>

0 commit comments

Comments
 (0)