Skip to content

Commit 85b994e

Browse files
committed
wip
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 16e7e8a commit 85b994e

File tree

13 files changed

+517
-395
lines changed

13 files changed

+517
-395
lines changed

vulnerabilities/models.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,9 +1136,9 @@ def get_affecting_vulnerabilities(self):
11361136
next_fixed_package_vulns = list(fixed_by_pkg.affected_by)
11371137

11381138
fixed_by_package_details["fixed_by_purl"] = fixed_by_purl
1139-
fixed_by_package_details["fixed_by_purl_vulnerabilities"] = (
1140-
next_fixed_package_vulns
1141-
)
1139+
fixed_by_package_details[
1140+
"fixed_by_purl_vulnerabilities"
1141+
] = next_fixed_package_vulns
11421142
fixed_by_pkgs.append(fixed_by_package_details)
11431143

11441144
vuln_details["fixed_by_package_details"] = fixed_by_pkgs
@@ -2515,7 +2515,7 @@ class AdvisoryToDoV2(models.Model):
25152515
help_text="Advisory/ies where this TODO is applicable.",
25162516
)
25172517

2518-
issue_type = models.CharField(
2518+
issue_type = models.CharField(
25192519
max_length=50,
25202520
choices=ISSUE_TYPE_CHOICES,
25212521
db_index=True,
@@ -2552,7 +2552,8 @@ class AdvisoryToDoV2(models.Model):
25522552
class Meta:
25532553
unique_together = ("related_advisories_id", "issue_type")
25542554

2555-
#todo add index!
2555+
# todo add index!
2556+
# use uuid for todo identification.
25562557

25572558

25582559
class AdvisorySeverity(models.Model):

vulnerabilities/pipes/openssl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ def get_reference(reference_name, tag, reference_url):
8989
ref_type = (
9090
AdvisoryReference.COMMIT
9191
if "commit" in name or tag == "patch"
92-
else AdvisoryReference.ADVISORY if "advisory" in name else AdvisoryReference.OTHER
92+
else AdvisoryReference.ADVISORY
93+
if "advisory" in name
94+
else AdvisoryReference.OTHER
9395
)
9496

9597
return ReferenceV2(
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
{% extends "base.html" %}
2+
{% load utils %}
3+
4+
{% block title %}
5+
Advisory To-Dos
6+
{% endblock %}
7+
8+
{% block extrahead %}
9+
<style>
10+
thead th {
11+
border-bottom: none !important;
12+
}
13+
14+
tbody tr:hover {
15+
background-color: #e0e0e0 !important;
16+
cursor: pointer;
17+
}
18+
19+
tbody tr:nth-child(even):hover {
20+
background-color: #d3d3d3 !important;
21+
}
22+
23+
.column {
24+
word-break: break-word;
25+
}
26+
</style>
27+
{% endblock %}
28+
29+
30+
{% block content %}
31+
<div class="columns">
32+
<div class="column">
33+
</div>
34+
35+
<div class="column is-four-fifths">
36+
<div class="content is-normal">
37+
<h1>Advisory To-Dos</h1>
38+
<hr />
39+
</div>
40+
<form method="get" class="box px-6 mx-0">
41+
42+
<div class="field has-addons">
43+
<div class="control is-expanded has-icons-right">
44+
{{ form.search }}
45+
46+
{% if form.search.value %}
47+
<a href="?{% querystring request search='' %}"
48+
class="icon is-right"
49+
style="pointer-events: auto; cursor: pointer;">
50+
51+
</a>
52+
{% endif %}
53+
</div>
54+
55+
<div class="control">
56+
<button type="submit" class="button is-info">
57+
<i class="fa fa-search mx-1"></i>
58+
</button>
59+
</div>
60+
</div>
61+
</form>
62+
63+
<div class="box">
64+
<!-- <div class="column has-text-right">
65+
<p class="has-text-weight-semibold">
66+
{{ active_pipeline_count|default:0 }} active pipeline{{ active_pipeline_count|default:0|pluralize }},
67+
{{ disabled_pipeline_count|default:0 }} disabled pipeline{{ disabled_pipeline_count|default:0|pluralize }}
68+
</p>
69+
</div> -->
70+
<table class="table is-striped is-hoverable is-fullwidth">
71+
<thead>
72+
<tr>
73+
<th colspan="4">
74+
<div class="box is-small">
75+
<div class="columns is-vcentered">
76+
<div class="column has-text-centered" style="flex: 0 0 15%; font-weight: bold;">CVE</div>
77+
<div class="column has-text-centered" style="flex: 0 0 20%; font-weight: bold;">Aliases</div>
78+
<div class="column has-text-centered" style="flex: 0 0 15%; font-weight: bold;">Resolved</div>
79+
<div class="column has-text-centered" style="flex: 0 0 10%; font-weight: bold;"># Advisories</div>
80+
<div class="column has-text-centered" style="flex: 0 0 40%; font-weight: bold;">Issue</div>
81+
</div>
82+
</div>
83+
</th>
84+
</tr>
85+
<tr>
86+
<th colspan="4">
87+
<form method="get">
88+
<input type="hidden" name="search" value="{{ form.search.value|default:'' }}">
89+
90+
<div class="columns is-vcentered px-1">
91+
<div class="column has-text-centered" style="flex: 0 0 15%;"></div>
92+
<div class="column has-text-centered" style="flex: 0 0 20%;"></div>
93+
94+
<div class="column has-text-centered" style="flex: 0 0 15%;">
95+
<div class="select is-fullwidth">
96+
<select name="resolved" onchange="this.form.submit()">
97+
{% for val, label in form.fields.resolved.choices %}
98+
<option value="{{ val }}"
99+
{% if form.resolved.value == val %}selected{% endif %}>
100+
{{ label }}
101+
</option>
102+
{% endfor %}
103+
</select>
104+
</div>
105+
</div>
106+
107+
<div class="column has-text-centered" style="flex: 0 0 10%;"></div>
108+
109+
<div class="column has-text-centered" style="flex: 0 0 40%;">
110+
<div class="select is-fullwidth">
111+
<select name="issue_type" onchange="this.form.submit()">
112+
{% for val, label in form.fields.issue_type.choices %}
113+
<option value="{{ val }}"
114+
{% if form.issue_type.value == val %}selected{% endif %}>
115+
{{ label }}
116+
</option>
117+
{% endfor %}
118+
</select>
119+
</div>
120+
</div>
121+
</div>
122+
</form>
123+
</th>
124+
</tr>
125+
</thead>
126+
127+
<tbody>
128+
{% for todo in todo_list %}
129+
<tr>
130+
<td colspan="4">
131+
<a href="{% url 'todo-detail' pk=todo.id %}" class="has-text-info">
132+
<div class="columns px-1 is-vcentered">
133+
<div class="column has-text-centered" style="flex: 0 0 15%;">
134+
{{ identifiers|get_item:todo.id|get_item:"identifier" }}
135+
</div>
136+
<div class="column has-text-centered" style="flex: 0 0 20%;">
137+
{{ identifiers|get_item:todo.id|get_item:"aliases"|default_if_none:""|join:", "|default:"NA" }}
138+
</div>
139+
<div class="column has-text-centered has-text-grey" style="flex: 0 0 15%;">
140+
{{ todo.is_resolved|yesno:"Yes,No" }}
141+
</div>
142+
<div class="column has-text-centered has-text-grey" style="flex: 0 0 10%;">
143+
{{ todo.advisories.all|length }}
144+
</div>
145+
<div class="column has-text-centered has-text-grey" style="flex: 0 0 40%;">
146+
{{ todo.get_issue_type_display }}
147+
</div>
148+
</div>
149+
</a>
150+
</td>
151+
</tr>
152+
{% empty %}
153+
<tr>
154+
<td colspan="4" class="has-text-centered">No pipeline found.</td>
155+
</tr>
156+
{% endfor %}
157+
</tbody>
158+
</table>
159+
</div>
160+
{% include "includes/pagination_v2.html" with page_obj=page_obj %}
161+
</div>
162+
<div class="column"></div>
163+
</div>
164+
{% endblock %}
165+

0 commit comments

Comments
 (0)