Skip to content
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

Validate and fix TXT and SPF record values #423

Closed
peteeckel opened this issue Oct 10, 2024 · 0 comments · Fixed by #424
Closed

Validate and fix TXT and SPF record values #423

peteeckel opened this issue Oct 10, 2024 · 0 comments · Fixed by #424
Assignees
Labels
enhancement New feature or request

Comments

@peteeckel
Copy link
Owner

Currently the values for TXT and SPF records are not actually validated except for the checks imposed by running them through the validation provided by rdata.from_text(). This proved both not enough and too much validation in practice and requires manual intervention in some cases. One of these cases came up in #269.

The restrictions applicable to TXT and SPF records are:

  • The records only allow printable ASCII characters in their value RFC4408, Section 3.1.1
  • The value can consist of one or more character strings with a maximum length of 255 characters (the 256th contains the length of the string) RFC1035, Section 3.3
  • Character strings can be enclosed in double quotes if necessary. The quotes do not count against the maximum length. RFC1035, Section 3.3
  • If multiple strings are passed, the effective value is the concatenation of these strings RFC4408, Section 3.1.3

dnspython performs part of the validation, but does not check the character set and does not have a mechanism to break up a record value into multiple strings if the length exceeds 255 characters. Therefore, some additional validation and a fixup mechanism is required to comfortably handle large TXT and SPF records.

Breaking up a long value is tedious at best, and error prone on top of that, so an automatism is highly desirable. NetBox DNS should take that onus off the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant