Peter Thomassen 3 роки тому
батько
коміт
f82221b535

+ 0 - 2
api/desecapi/exception_handlers.py

@@ -1,7 +1,6 @@
 import logging
 
 from django.db.utils import IntegrityError, OperationalError
-from psl_dns.exceptions import UnsupportedRule
 from rest_framework import status
 from rest_framework.response import Response
 from rest_framework.views import exception_handler as drf_exception_handler
@@ -52,7 +51,6 @@ def exception_handler(exc, context):
     handlers = {
         IntegrityError: _409,
         OSError: _500,  # OSError happens on system-related errors, like full disk or getaddrinfo() failure.
-        UnsupportedRule: _500,  # The PSL encountered an unsupported rule
         PDNSException: _500,  # nslord/nsmaster returned an error
     }
 

+ 0 - 7
api/desecapi/models.py

@@ -265,13 +265,6 @@ class Domain(ExportModelOperationsMixin('Domain'), models.Model):
         except (Timeout, NoNameservers):
             public_suffix = self.name.rpartition('.')[2]
             is_public_suffix = ('.' not in self.name)  # TLDs are public suffixes
-        except psl_dns.exceptions.UnsupportedRule as e:
-            # It would probably be fine to treat this as a non-public suffix (with the TLD acting as the
-            # public suffix and setting both public_suffix and is_public_suffix accordingly).
-            # However, in order to allow to investigate the situation, it's better not catch
-            # this exception. For web requests, our error handler turns it into a 503 error
-            # and makes sure admins are notified.
-            raise e
 
         if is_public_suffix:
             return public_suffix

+ 0 - 9
api/desecapi/tests/test_domains.py

@@ -1,7 +1,6 @@
 from django.conf import settings
 from django.core import mail
 from django.core.exceptions import ValidationError
-from psl_dns.exceptions import UnsupportedRule
 from rest_framework import status
 
 from desecapi.models import Domain
@@ -352,14 +351,6 @@ class DomainOwnerTestCase1(DomainOwnerTestCase):
             response = self.client.post(self.reverse('v1:domain-list'), {'name': name})
             self.assertStatus(response, status.HTTP_201_CREATED)
 
-    def test_create_domain_under_unsupported_public_suffix_rule(self):
-        # Show lenience if the PSL library produces an UnsupportedRule exception
-        name = 'unsupported.wildcard.test'
-        psl_cm = self.get_psl_context_manager(UnsupportedRule)
-        with psl_cm, self.assertPdnsRequests():
-            response = self.client.post(self.reverse('v1:domain-list'), {'name': name})
-            self.assertStatus(response, status.HTTP_500_INTERNAL_SERVER_ERROR)
-
     def test_create_domain_policy(self):
         for name in ['1.2.3..4.test.dedyn.io', 'test..de', '*.' + self.random_domain_name(), 'a' * 64 + '.bla.test']:
             response = self.client.post(self.reverse('v1:domain-list'), {'name': name})

+ 1 - 1
api/requirements.txt

@@ -13,7 +13,7 @@ dnspython~=2.2.0
 httpretty~=1.0.5
 psycopg2~=2.9.2
 prometheus-client~=0.12.0  # added to control django-prometheus' dependency version
-psl-dns~=1.0.0
+psl-dns~=1.1.0
 pylibmc~=1.6.1
 pyyaml~=6.0
 requests~=2.26.0