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:
@@ -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']))
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user