mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge pull request #1171 from octodns/caa-tags
Fix CAA value handling to support tags
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
## v1.?.? - 2024-??-?? - ???
|
||||
|
||||
* Fix CAA rdata parsing to allow values with tags
|
||||
|
||||
## v1.7.0 - 2024-04-29 - All the knobs and dials
|
||||
|
||||
* Support for specifying per-zone change thresholds, to allow for zones
|
||||
|
||||
@@ -13,7 +13,8 @@ class CaaValue(EqualityTupleMixin, dict):
|
||||
@classmethod
|
||||
def parse_rdata_text(cls, value):
|
||||
try:
|
||||
flags, tag, value = value.split(' ')
|
||||
# value may contain whitepsace
|
||||
flags, tag, value = value.split(' ', 2)
|
||||
except ValueError:
|
||||
raise RrParseError()
|
||||
try:
|
||||
|
||||
@@ -41,7 +41,7 @@ class TestRecordCaa(TestCase):
|
||||
self.assertEqual(a_data, a.data)
|
||||
|
||||
b_value = CaaValue(
|
||||
{'tag': 'iodef', 'value': 'http://iodef.example.com/'}
|
||||
{'tag': 'iodef', 'value': 'http://iodef.example.com/; key=value'}
|
||||
)
|
||||
b_data = {'ttl': 30, 'value': b_value}
|
||||
b = CaaRecord(self.zone, 'b', b_data)
|
||||
@@ -89,10 +89,6 @@ class TestRecordCaa(TestCase):
|
||||
with self.assertRaises(RrParseError):
|
||||
CaaValue.parse_rdata_text('0 tag')
|
||||
|
||||
# 4th word won't parse
|
||||
with self.assertRaises(RrParseError):
|
||||
CaaValue.parse_rdata_text('1 tag value another')
|
||||
|
||||
# flags not an int, will parse
|
||||
self.assertEqual(
|
||||
{'flags': 'one', 'tag': 'tag', 'value': 'value'},
|
||||
@@ -105,12 +101,24 @@ class TestRecordCaa(TestCase):
|
||||
CaaValue.parse_rdata_text('0 tag 99148c81'),
|
||||
)
|
||||
|
||||
# 4th word will parse, and be part of the value
|
||||
self.assertEqual(
|
||||
{'flags': 1, 'tag': 'tag', 'value': 'value another'},
|
||||
CaaValue.parse_rdata_text('1 tag value another'),
|
||||
)
|
||||
|
||||
# quoted
|
||||
self.assertEqual(
|
||||
{'flags': 0, 'tag': 'tag', 'value': '99148c81'},
|
||||
CaaValue.parse_rdata_text('0 "tag" "99148c81"'),
|
||||
)
|
||||
|
||||
# quoted w/4th word
|
||||
self.assertEqual(
|
||||
{'flags': 0, 'tag': 'tag', 'value': '99148c81 key=val'},
|
||||
CaaValue.parse_rdata_text('0 "tag" "99148c81 key=val"'),
|
||||
)
|
||||
|
||||
zone = Zone('unit.tests.', [])
|
||||
a = CaaRecord(
|
||||
zone,
|
||||
|
||||
Reference in New Issue
Block a user