Remove cve_visible field on security patches
authorMagnus Hagander <magnus@hagander.net>
Mon, 24 May 2021 10:29:37 +0000 (12:29 +0200)
committerMagnus Hagander <magnus@hagander.net>
Mon, 24 May 2021 10:32:03 +0000 (12:32 +0200)
Since we are not relying on external services for linking to security
patch information anymore, instead providing our own pages, this is no
longer used for anything. So get rid of it along with the cronjob to
update it.

pgweb/security/management/commands/update_cve_links.py [deleted file]
pgweb/security/migrations/0004_remove_securitypatch_cve_visible.py [new file with mode: 0644]

diff --git a/pgweb/security/management/commands/update_cve_links.py b/pgweb/security/management/commands/update_cve_links.py
deleted file mode 100644 (file)
index 6f3e619..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Script to poll for CVE links, to make the actual link visible
-# once they have showed up upstream.
-#
-
-from django.core.management.base import BaseCommand
-from django.db import transaction
-from django.conf import settings
-
-from pgweb.security.models import SecurityPatch
-from pgweb.mailqueue.util import send_simple_mail
-
-import requests
-
-
-class Command(BaseCommand):
-    help = 'Update CVE links'
-
-    def handle(self, *args, **options):
-        with transaction.atomic():
-            newly_visible = []
-            for s in SecurityPatch.objects.filter(cve_visible=False):
-                r = requests.get(s.cvelink, timeout=10)
-                if r.status_code == 200:
-                    # RedHat have started requiring both a HTML page and a JSON api call to view
-                    # CVEs. Dumb dumb dumb, but what can we do...
-                    r = requests.get('https://access.redhat.com/api/redhat_node/CVE-{}.json'.format(s.cve))
-                    if r.status_code == 200:
-                        newly_visible.append(s.cve)
-                        s.cve_visible = True
-                        s.save()
-            if newly_visible:
-                send_simple_mail(settings.NOTIFICATION_FROM,
-                                 settings.NOTIFICATION_EMAIL,
-                                 "CVE entries made public",
-                                 """The following CVE entries are now public upstream,
-and have been made visible on the website.
-
-{0}
-""".format("\n".join(newly_visible)))
diff --git a/pgweb/security/migrations/0004_remove_securitypatch_cve_visible.py b/pgweb/security/migrations/0004_remove_securitypatch_cve_visible.py
new file mode 100644 (file)
index 0000000..8dd6137
--- /dev/null
@@ -0,0 +1,17 @@
+# Generated by Django 2.2.11 on 2021-05-24 10:27
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('security', '0003_add_security_patch_details'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='securitypatch',
+            name='cve_visible',
+        ),
+    ]