This repository has been archived by the owner on Sep 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #617 from GreatFruitOmsk/543-cve-page
CVE page
- Loading branch information
Showing
10 changed files
with
432 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generated by Django 2.2.6 on 2020-01-09 11:37 | ||
|
||
import device_registry.models | ||
from django.db import migrations, models | ||
from django.db.models import Case, CharField, Value, When | ||
|
||
|
||
def convert_urgencies(apps, schema_editor): | ||
urgencies = { | ||
'Urgency.NONE': 0, | ||
'Urgency.LOW': 1, | ||
'Urgency.MEDIUM': 2, | ||
'Urgency.HIGH': 3, | ||
} | ||
Vulnerability = apps.get_model('device_registry', 'Vulnerability') | ||
Vulnerability.objects.update(urgency=Case( | ||
*[When(urgency=k, then=Value(v)) for k, v in urgencies.items()], | ||
default=Value(0) | ||
)) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('device_registry', '0078_merge_20200107_1719'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(convert_urgencies), | ||
migrations.AlterField( | ||
model_name='vulnerability', | ||
name='urgency', | ||
field=models.PositiveSmallIntegerField(choices=[(device_registry.models.Vulnerability.Urgency(0), 0), (device_registry.models.Vulnerability.Urgency(1), 1), (device_registry.models.Vulnerability.Urgency(2), 2), (device_registry.models.Vulnerability.Urgency(3), 3)]), | ||
), | ||
migrations.AddField( | ||
model_name='vulnerability', | ||
name='pub_date', | ||
field=models.DateField(null=True), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='vulnerability', | ||
unique_together={('os_release_codename', 'name', 'package')}, | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{% extends "admin_base.html" %} | ||
|
||
{% block title %}WoTT - CVE list{% endblock title %} | ||
|
||
{% block dashboard_title %} | ||
<h1 style="margin-bottom: 0">CVE list{% if device_name %} for {{ device_name }}{% endif %}</h1> | ||
{% endblock dashboard_title %} | ||
|
||
{% block admin_content %} | ||
<!-- cve.html --> | ||
<div class="container-fluid p-0"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<table class="table table-striped table-responsive-xs" > | ||
<thead> | ||
<th>CVE</th> | ||
<th>Date</th> | ||
<th>Severity</th> | ||
<th>Packages Affected</th> | ||
{% if not device_name %} | ||
<th>Nodes Affected</th> | ||
{% endif %} | ||
<th>Solve</th> | ||
</thead> | ||
<tbody> | ||
{% for row in table_rows %} | ||
<tr> | ||
<td> | ||
<a href="{{ row.cve_link.href }}">{{ row.cve_link.text }}</a> | ||
</td> | ||
<td>{{ row.cve_date|date:"Y-m-d"|default:"N/A" }}</td> | ||
<td>{{ row.severity }}</td> | ||
<td> | ||
{% for p in row.packages %} | ||
{{ p.name }} | ||
<br> | ||
{% endfor %} | ||
</td> | ||
{% if not device_name %} | ||
<td> | ||
{% for p in row.packages %} | ||
<a href="#" class="wott-popover"> | ||
{{ p.device_urls|length }} | ||
<template> | ||
{% for du in p.device_urls %} | ||
<a href="{{ du.href }}">{{ du.text }}</a><br> | ||
{% endfor %} | ||
</template> | ||
</a> | ||
<br> | ||
{% endfor %} | ||
</td> | ||
{% endif %} | ||
<td> | ||
{% for p in row.packages %} | ||
<a href="#" class="wott-popover"> | ||
Instructions | ||
<template> | ||
Run the following command: | ||
<pre>{{ p.upgrade_command }}</pre> | ||
</template> | ||
</a> | ||
<br> | ||
{% endfor %} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock admin_content %} | ||
|
||
{% block scripts %} | ||
{{ block.super }} | ||
|
||
<script> | ||
$(function () { | ||
$('[data-toggle="popover"]').popover() | ||
}); | ||
|
||
$('.wott-popover').popover({ | ||
html: true, | ||
trigger: 'click', | ||
title: 'Details', | ||
content: function() { | ||
return $(this).children('template').html(); | ||
} | ||
}) | ||
</script> | ||
{% endblock scripts %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.