-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move RR content validation away from nslord #385
Conversation
d8a2419
to
60fe992
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets a couple more tests, but is ready for generally ready for review :)
7768554
to
b7cbdac
Compare
In relation to #334, this imposes an additional 255 char limit "per field" which we may not want |
Actually, this limit is per "token" and not per record, and was apparently introduced by BIND. It seems to be widely accepted although I could not find any standard on it. With the current status of this PR, we would start to enforce this widely accepted non-standard limitation, because it is enforced by dnspython. We could make an exception, but this may interfere with future development that we have planned. I separated the tests for the "255 limit" per token and "500 limit" per record, and adapted the error message for the former appropriately. |
I can clarify the size limits. TXT records are composed of In ASCII presentation format a So for example a single zero byte There is no size limit on the TXT record itself other than imposed by RDLENGTH (16-bits) and the restraints of being in a message (header, RR owner meta, etc). |
I should also mention that PowerDNS doesn't parse TXT records in an entirely standard way. It is briefly mentioned here but I can't find a precise reference to exactly what it does. Possibly its behaviour has lead to some of the confusion here. |
Ah, I also remember that pdns permits TXT records to be longer than 255 bytes "on the admin side" (database, API etc.), and handles the 255-byte chunking as an aspect of client-side serialization. I think that's a pretty reasonable decision, but it causes the above problem if we introduce a validation layer that works a) on the data that we want to send to the pdns API, but b) is based on "client-side style" serialization/deserialization (using dnspython). @Habbie, did I summarize this correctly? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I have some minor suggestions regarding code smoothness here and there, but otherwise really great.
There's of course the outstanding issue with the 255 byte limit (it's actually a mismatch between what our API considers a record, and what dnspython considers a record or token), and the inclusion of SMIMEA.
resolved a couple of annotations, added a couple of tests. Of particular interest are the TXT canonicalization tests: we newly accept now The increase of the max token length is still missing. |
6857403
to
f5e813d
Compare
I (re)introduced non-standard TXT/SPF records with token length up to 256**8-1. The validation is now still based upon dnspython, but involves quite some copy-paste code. Not sure how we want to proceed with this, some options:
Instead of a database migration, I opted to canonicalize record content every time we talk to pdns. We can apply a migration anytime (not saying it shouldn't be now) and then remove this piece of code again. Some tests for more specific record types are still missing. |
Anyways, this extends the TXT record interface to also accept not-quoted record contents. For interpretation details, see the tests. (It follows RFC 1035 with the exception of longer tokens.) |
f5e813d
to
b1e98fa
Compare
This needs some more e2e testing to make sure pdns accepts our canonicalized input. |
2b40c35
to
4f9ec40
Compare
I cleaned up the history. What's still missing:
|
ade3217
to
8a13302
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff! Lgtm, very minor comments
cb06b03
to
9d3f501
Compare
ready for second round, everything after the force push is new and addressing review comments |
This fixes some faulty behavior, such as - returning 503 when actually 500 is appropriate and - counting db-unrelated errors towards the db outage metric.
8230dd6
to
2c7c319
Compare
ready for next round of review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two small changes
docs/dns/rrsets.rst
Outdated
@@ -93,8 +93,8 @@ Field details: | |||
Records must be given in presentation format (a.k.a. "BIND" or zone file | |||
format). Record values that are not given in canonical format, such as | |||
``127.000.0.1`` will be converted by the API into canonical format, e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjust (leading zeros disallowed)
83d3b6f
to
8fdb998
Compare
No description provided.