dnscontrol: The content field of TXT records must be in quotation marks, but is not?

Describe the bug

Cloudflare is complaining about TXT entries (including those from SPF_BUILDER and DMARC_BUILDER entries):

The content field of TXT records must be in quotation marks. Cloudflare may add quotation marks on your behalf, which will not affect how the record works.

To Reproduce Steps to reproduce the behavior:

  1. Use Cloudflare as DNS provider
  2. Use a DNSControl configuration file with TXT entries
  3. Push your changes
  4. See error in Cloudflare dashboard (click on red triangle with exclamation mark inside)

Expected behavior No warnings/errors in Cloudflare dashboard

DNS Provider

  • Cloudflare

Additional context N/A

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Use TXT("@", "test").

The TXT(label, data) function expects data to be a JSON-encoded string. The resulting string will be used to create a TXT record that displays that exact string. That string (according to rfc6376) does not begin and end with double-quotes. Therefore, you shouldn’t add them.

While I’m otherwise a fan of Cloudflare, I feel they get this wrong. This warning is inappropriate if the record was updated via the API, such as when using DNSControl. According to https://github.com/StackExchange/dnscontrol/issues/3172#issuecomment-2469452565, they are considering changing their UI.

I think they’ve confused the RFC 1035 file format and the wire-format of the txt record.

Let me get some popcorn. This is going to be fun to watch.

Originally posted (13 jun.) by @janik-cloudflare in Cloudflare community: Importing TXT records adds quotes, breaking records (comment)

Hi! TXT record contents always consist of a set of “strings”, each with a length of up to 255 bytes. Strings are typically represented as quoted sections, for example:

"the first string" "second" "another, third string"

While it wasn’t in the past, our behavior regarding zone file imports should now be correct and RFC-compliant, adding explicit quotes to imported TXT records. These explicit quotes are currently shown in both API and dashboard.

For simplicity and historical reasons, contents without explicit surrounding quotes are treated as a single string, only being split up if the 255-byte limit is exceeded. For example, one two three is treated as "one two three", even though, strictly speaking, the RFC-compliant interpretation would be "one" "two" "three". In the future, we may disallow unquoted TXT contents as we move to be fully RFC-compliant. For that reason, explicit quotes around strings in TXT record contents are expected and in fact strongly encouraged. These quotes should not cause any issues and in fact records with contents hello and "hello" will be exactly, byte-for-byte identical at the edge.


Originally posted (11 sep.) by @janik-cloudflare in Cloudflare community: Warning for TXT records without double quotes (comment)

Hi @mykhailo.oleksiuk! We’ve temporarily removed the warning while we write up some more documentation around this. We still recommend adding quotes, but we’ll likely also have the UI do that automatically in the future. Existing records may also be updated at some point, but since that’s a fairly large (breaking) change, it would be done slowly and after prior announcement.

There isn’t an urgent need to quote TXT contents right now, though it’s the more correct (RFC 1035) and unambiguous way to represent them, so in general we recommend it. At least for new records it’s probably a good idea! If you’re able to get existing records updated even better, but don’t feel pressured to do.

Hope that helps a little, at least until we have more documentation written up!

On the other hand, they are pretty explicit about the quotation marks in their help pages about TXT records:

However, TXT records still store their content within quotation marks (“”).