Skip to content

Commit 645d9cc

Browse files
committed
Update UI to have a new tab Package Commit Patches Details
Sort PackageCommitPatchViewSet Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent dc40ea8 commit 645d9cc

4 files changed

Lines changed: 100 additions & 61 deletions

File tree

vulnerabilities/templates/advisory_detail.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@
193193
</a>
194194
</td>
195195
</tr>
196+
<tr>
197+
<td class="two-col-left"
198+
data-tooltip="Risk expressed as a number ranging from 0 to 10. It is calculated by multiplying
199+
the weighted severity and exploitability values, capped at a maximum of 10.
200+
"
201+
>Introduced and Fixed Package Commit Patches</td>
202+
<td class="two-col-right wrap-strings">
203+
<a href="/advisories/commits/{{ advisory.avid }}">
204+
Package Commit Patches Details
205+
</a>
206+
</td>
207+
</tr>
196208
</tbody>
197209
</table>
198210
<div class="has-text-weight-bold tab-nested-div ml-1 mb-1 mt-6">
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{% extends "base.html" %}
2+
{% load humanize %}
3+
{% load widget_tweaks %}
4+
{% load static %}
5+
{% load show_cvss %}
6+
{% load url_filters %}
7+
8+
{% block title %}
9+
VulnerableCode Advisory Package Commit Patch Details - {{ advisoryv2.advisory_id }}
10+
{% endblock %}
11+
12+
{% block content %}
13+
14+
{% if advisoryv2 %}
15+
<section class="section pt-0">
16+
<div class="details-container">
17+
<article class="panel is-info panel-header-only">
18+
<div class="panel-heading py-2 is-size-6">
19+
Introduce and Fixing Package Commit Patch details for Advisory:
20+
<span class="tag is-white custom">
21+
{{ advisoryv2.advisory_id }}
22+
</span>
23+
</div>
24+
</article>
25+
26+
<div id="tab-content">
27+
<table class="table vcio-table width-100-pct mt-2">
28+
<thead>
29+
<tr>
30+
<th style="width: 50%;">Introduced in</th>
31+
<th>Fixed by</th>
32+
</tr>
33+
</thead>
34+
<tbody>
35+
{% for impact in advisoryv2.impacted_packages.all %}
36+
{% for pkg_commit_patch in impact.introduced_by_package_commit_patches.all %}
37+
<tr>
38+
<td>
39+
<a href="{{ pkg_commit_patch.patch_url }}" target="_self">
40+
{{ pkg_commit_patch.vcs_url }}@{{ pkg_commit_patch.commit_hash }}
41+
</a>
42+
<br />
43+
<a href="{{ pkg_commit_patch.patch_url }}" target="_self">{{ pkg_commit_patch.patch_url }}</a>
44+
</td>
45+
<td></td>
46+
</tr>
47+
{% endfor %}
48+
49+
{% for pkg_commit_patch in impact.fixed_by_package_commit_patches.all %}
50+
<tr>
51+
<td></td>
52+
<td>
53+
<a href="{{ pkg_commit_patch.commit_url }}" target="_self">
54+
{{ impact.base_purl }}@{{ pkg_commit_patch.commit_hash }}
55+
</a>
56+
<br />
57+
58+
{% if pkg_commit_patch.patch_url %}
59+
<a href="{{ pkg_commit_patch.patch_url }}" target="_self">{{ pkg_commit_patch.patch_url }}</a>
60+
{% endif %}
61+
</td>
62+
</tr>
63+
{% endfor %}
64+
65+
{% empty %}
66+
<tr>
67+
<td colspan="2">
68+
This vulnerability is not known to affect any package commits.
69+
</td>
70+
</tr>
71+
{% endfor %}
72+
</tbody>
73+
</table>
74+
</div>
75+
76+
</div>
77+
</section>
78+
{% endif %}
79+
80+
<script src="{% static 'js/main.js' %}" crossorigin="anonymous"></script>
81+
82+
{% endblock %}

vulnerabilities/templates/advisory_package_details.html

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -60,67 +60,6 @@
6060
</div>
6161
</div>
6262
</section>
63-
<section class="section pt-0">
64-
<div class="details-container">
65-
<article class="panel is-info panel-header-only">
66-
<div class="panel-heading py-2 is-size-6">
67-
Vulnerable and Fixing Package Commit Patch details for Advisory:
68-
<span class="tag is-white custom">
69-
{{ advisoryv2.advisory_id }}
70-
</span>
71-
</div>
72-
</article>
73-
74-
<div id="tab-content">
75-
<table class="table vcio-table width-100-pct mt-2">
76-
<thead>
77-
<tr>
78-
<th style="width: 50%;">Introduced in</th>
79-
<th>Fixed by</th>
80-
</tr>
81-
</thead>
82-
<tbody>
83-
{% for impact in advisoryv2.impacted_packages.all %}
84-
85-
{% for pkg_commit_patch in impact.introduced_by_package_commit_patches.all %}
86-
<tr>
87-
<td>
88-
<a href="{{ pkg_commit_patch.patch_url }}" target="_self">
89-
{{ pkg_commit_patch.vcs_url }}@{{ pkg_commit_patch.commit_hash }}
90-
</a>
91-
<br />
92-
<a href="{{ pkg_commit_patch.patch_url }}" target="_self">{{ pkg_commit_patch.patch_url }}</a>
93-
</td>
94-
<td></td>
95-
</tr>
96-
{% endfor %}
97-
98-
{% for pkg_commit_patch in impact.fixed_by_package_commit_patches.all %}
99-
<tr>
100-
<td></td>
101-
<td>
102-
<a href="{{ pkg_commit_patch.commit_url }}" target="_self">
103-
{{ impact.base_purl }}@{{ pkg_commit_patch.commit_hash }}
104-
</a>
105-
<br />
106-
<a href="{{ pkg_commit_patch.patch_url }}" target="_self">{{ pkg_commit_patch.patch_url }}</a>
107-
</td>
108-
</tr>
109-
{% endfor %}
110-
111-
{% empty %}
112-
<tr>
113-
<td colspan="2">
114-
This vulnerability is not known to affect any package commits.
115-
</td>
116-
</tr>
117-
{% endfor %}
118-
</tbody>
119-
</table>
120-
</div>
121-
122-
</div>
123-
</section>
12463
{% endif %}
12564

12665
<script src="{% static 'js/main.js' %}" crossorigin="anonymous"></script>

vulnerablecode/urls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from vulnerabilities.api_v3 import PackageV3ViewSet
3232
from vulnerabilities.views import AdminLoginView
3333
from vulnerabilities.views import AdvisoryDetails
34+
from vulnerabilities.views import AdvisoryPackageCommitPatchDetails
3435
from vulnerabilities.views import AdvisoryPackagesDetails
3536
from vulnerabilities.views import AffectedByAdvisoriesListView
3637
from vulnerabilities.views import ApiUserCreateView
@@ -119,6 +120,11 @@ def __init__(self, *args, **kwargs):
119120
AdvisoryPackagesDetails.as_view(),
120121
name="advisory_package_details",
121122
),
123+
path(
124+
"advisories/commits/<path:avid>",
125+
AdvisoryPackageCommitPatchDetails.as_view(),
126+
name="advisory_package_commit_details",
127+
),
122128
path(
123129
"advisories/<path:avid>",
124130
AdvisoryDetails.as_view(),

0 commit comments

Comments
 (0)