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
CVE list: Show only the currently running kernel meta-package #791
Merged
a-martynovich
merged 6 commits into
WoTTsecurity:master
from
GreatFruitOmsk:750-cve-kernel-meta-packages
Mar 19, 2020
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9c20aa5
CVE list: Show only the currently running kernel meta-package
pythonpro e338817
Moved reboot required decision to the agent side
pythonpro 3083d7e
Full support of Ubuntu and Amazon Linux 2
pythonpro 3de30b2
Production-ready text for the new RA
pythonpro bc9803e
Add all possible vendor-specific headers packages support
pythonpro 70596a1
Merge branch 'master' into 750-cve-kernel-meta-packages
a-martynovich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
40 changes: 40 additions & 0 deletions
40
backend/device_registry/migrations/0088_auto_20200306_1702.py
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,40 @@ | ||
# Generated by Django 2.2.10 on 2020-03-06 17:02 | ||
|
||
from django.db import migrations, models | ||
|
||
from device_registry.models import UBUNTU_SUITES, UBUNTU_KERNEL_PACKAGES_RE_PATTERN | ||
|
||
|
||
def reset_kernel_packages_vulns(apps, schema_editor): | ||
# Delete vulns of kernel-related packages. | ||
DebPackageVulnerability = apps.get_model('device_registry', 'DebPackage').vulnerabilities.through | ||
# Ubuntu. | ||
DebPackageVulnerability.objects.filter( | ||
debpackage__os_release_codename__in=UBUNTU_SUITES, debpackage__name__regex=UBUNTU_KERNEL_PACKAGES_RE_PATTERN | ||
).delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('device_registry', '0087_auto_20200318_0652'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='device', | ||
name='reboot_required', | ||
field=models.BooleanField(blank=True, db_index=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='vulnerability', | ||
name='name', | ||
field=models.CharField(db_index=True, max_length=64), | ||
), | ||
migrations.AlterField( | ||
model_name='vulnerability', | ||
name='fix_available', | ||
field=models.BooleanField(db_index=True), | ||
), | ||
migrations.RunPython(reset_kernel_packages_vulns) | ||
] |
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 |
---|---|---|
|
@@ -497,6 +497,19 @@ def severity(cls, param=None): | |
return Severity.MED | ||
|
||
|
||
# OS reboot required action. | ||
class RebootRequiredAction(SimpleAction, metaclass=ActionMeta): | ||
_severity = Severity.MED | ||
|
||
@classmethod | ||
def _affected_devices(cls, qs): | ||
return qs.filter(reboot_required=True) | ||
|
||
@classmethod | ||
def _is_affected(cls, device) -> bool: | ||
return device.reboot_required is True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please implement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The one from the parent class is ok There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know, but if it can be done with a simple query, then why not |
||
|
||
|
||
# Automatic security update disabled action. | ||
class AutoUpdatesAction(SimpleAction, metaclass=ActionMeta): | ||
@classmethod | ||
|
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 |
---|---|---|
|
@@ -697,7 +697,7 @@ def get_context_data(self, **kwargs): | |
vuln_names = Vulnerability.objects.filter(vuln_query)\ | ||
.values('name').distinct() | ||
vuln_pub_dates_qs = Vulnerability.objects.filter(name__in=vuln_names) \ | ||
.values('name').annotate(pubdate=Max('pub_date')).distinct() | ||
.values('name').distinct().annotate(pubdate=Max('pub_date')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does this change? |
||
# Build a lookup dictionary for CVE publication dates. | ||
vuln_pub_dates = {v['name']: v['pubdate'] for v in vuln_pub_dates_qs} | ||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add
(gcp|kvm|oem|oem-osp1|azure|azure-edge|oracle|gke|raspi2)-headers
here (see linux-headers)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done