1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Get out of the business of validating CAA records

Seem to be pretty inconsistently implemented/validated across providers so
just shrug and move on.
This commit is contained in:
Ross McFarland
2017-08-28 13:40:25 -07:00
parent e43da949a3
commit ba6dc9858e
2 changed files with 14 additions and 3 deletions

View File

@@ -393,7 +393,7 @@ class CaaValue(object):
reasons = []
try:
flags = int(value.get('flags', 0))
if flags not in (0, 128):
if flags < 0 or flags > 255:
reasons.append('invalid flags "{}"'.format(flags))
except ValueError:
reasons.append('invalid flags "{}"'.format(value['flags']))

View File

@@ -939,12 +939,23 @@ class TestRecordValidation(TestCase):
'type': 'CAA',
'ttl': 600,
'value': {
'flags': 42,
'flags': -42,
'tag': 'iodef',
'value': 'http://foo.bar.com/',
}
})
self.assertEquals(['invalid flags "42"'], ctx.exception.reasons)
self.assertEquals(['invalid flags "-42"'], ctx.exception.reasons)
with self.assertRaises(ValidationError) as ctx:
Record.new(self.zone, '', {
'type': 'CAA',
'ttl': 600,
'value': {
'flags': 442,
'tag': 'iodef',
'value': 'http://foo.bar.com/',
}
})
self.assertEquals(['invalid flags "442"'], ctx.exception.reasons)
with self.assertRaises(ValidationError) as ctx:
Record.new(self.zone, '', {
'type': 'CAA',