diff options
author | Christian Rohmann <christian.rohmann@inovex.de> | 2022-01-20 15:20:35 +0100 |
---|---|---|
committer | Michael Johnson <johnsomor@gmail.com> | 2022-06-02 03:56:02 +0000 |
commit | 53cf9b96f58decad03c3e4dedbb33d7b5777a6b0 (patch) | |
tree | 8fd8b69fa2f081e3db922cce7e2331abacdd272d | |
parent | 2e55c3e24bfaf1b03241aa1a4a538d03c29d69ad (diff) | |
download | designate-53cf9b96f58decad03c3e4dedbb33d7b5777a6b0.tar.gz |
Allow email subadresses to be used within mail url of CAA records
This patch allows for +subaddress to be used for the local part of mail urls
used for CAA records. While there are more characters allowed in email
addresses, using subadresses for incoming email to role accounts is quite
common.
Closes-Bug: 1958533
Change-Id: Id265fa1dfa5c0703d8e95b5de1334d4ca716fbc0
(cherry picked from commit 1cef20edbc462fab75a919fc0de796c2d6edb30b)
-rw-r--r-- | designate/objects/fields.py | 2 | ||||
-rw-r--r-- | designate/tests/unit/objects/test_caa_object.py | 7 | ||||
-rw-r--r-- | releasenotes/notes/bug-1958533-allow-caa-mail-subaddr-d02cdc46bbb118ad.yaml | 10 |
3 files changed, 18 insertions, 1 deletions
diff --git a/designate/objects/fields.py b/designate/objects/fields.py index 19a52c0d..4946c836 100644 --- a/designate/objects/fields.py +++ b/designate/objects/fields.py @@ -100,7 +100,7 @@ class StringFields(ovoo_fields.StringField): RE_NAPTR_SERVICE = r'^([A-Za-z]([A-Za-z0-9]*)(\+[A-Za-z]([A-Za-z0-9]{0,31}))*)?' # noqa RE_NAPTR_REGEXP = r'^([^0-9i\\])(.*)\1((.+)|(\\[1-9]))\1(i?)' RE_KVP = r'^\s[A-Za-z0-9]+=[A-Za-z0-9]+' - RE_URL_MAIL = r'^mailto:[A-Za-z0-9_\-]+@.*' + RE_URL_MAIL = r'^mailto:[A-Za-z0-9_\-]+(\+[A-Za-z0-9_\-]+)?@.*' RE_URL_HTTP = r'^http(s)?://.*/' def __init__(self, nullable=False, read_only=False, diff --git a/designate/tests/unit/objects/test_caa_object.py b/designate/tests/unit/objects/test_caa_object.py index 877ffb25..b6b0b070 100644 --- a/designate/tests/unit/objects/test_caa_object.py +++ b/designate/tests/unit/objects/test_caa_object.py @@ -50,6 +50,13 @@ class CAARecordTest(oslotest.base.BaseTestCase): self.assertEqual(0, caa_record.flags) self.assertEqual('iodef mailto:security@example.net', caa_record.prpt) + caa_record = objects.CAA() + caa_record._from_string('0 iodef mailto:security+caa@example.net') + + self.assertEqual(0, caa_record.flags) + self.assertEqual('iodef mailto:security+caa@example.net', + caa_record.prpt) + def test_parse_caa_invalid(self): caa_record = objects.CAA() self.assertRaisesRegex( diff --git a/releasenotes/notes/bug-1958533-allow-caa-mail-subaddr-d02cdc46bbb118ad.yaml b/releasenotes/notes/bug-1958533-allow-caa-mail-subaddr-d02cdc46bbb118ad.yaml new file mode 100644 index 00000000..694d0d2f --- /dev/null +++ b/releasenotes/notes/bug-1958533-allow-caa-mail-subaddr-d02cdc46bbb118ad.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - | + CAA records now allow the use of `+` prefixed subadresses like + `security+caa@example.net` within mail urls. + (https://www.rfc-editor.org/rfc/rfc5233.html#section-1) + + See `bug 1958533`_ for more information. + + .. _bug 1958533: https://bugs.launchpad.net/designate/+bug/1958533 |