Browse Source

Get out of the business of validating CAA records

Seem to be pretty inconsistently implemented/validated across providers so
just shrug and move on.
pull/103/head
Ross McFarland 8 years ago
parent
commit
ba6dc9858e
No known key found for this signature in database GPG Key ID: 61C10C4FC8FE4A89
2 changed files with 14 additions and 3 deletions
  1. +1
    -1
      octodns/record.py
  2. +13
    -2
      tests/test_octodns_record.py

+ 1
- 1
octodns/record.py View File

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


+ 13
- 2
tests/test_octodns_record.py View File

@ -939,12 +939,23 @@ class TestRecordValidation(TestCase):
'type': 'CAA', 'type': 'CAA',
'ttl': 600, 'ttl': 600,
'value': { 'value': {
'flags': 42,
'flags': -42,
'tag': 'iodef', 'tag': 'iodef',
'value': 'http://foo.bar.com/', '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: with self.assertRaises(ValidationError) as ctx:
Record.new(self.zone, '', { Record.new(self.zone, '', {
'type': 'CAA', 'type': 'CAA',


Loading…
Cancel
Save