TXT record testing
Last updated
Last updated
We recently discovered a strange bug with processing TXT records and double-quotes. Sadly we haven't been able to determine a way to test this automatically. Therefore, I've written up this methodology.
The problem relates to TXT records that have a string with quotes in them.
If a user creates a TXT record whose contents are "something"
(yes, with double quotes), some APIs get confused.
This bug is most likely to appear in a provider that uses RecordConfig.PopulateFromString()
(see models/t_parse.go
) to create TXT records. That function assumes the string should always have the quotes stripped, though it is more likely that the string should be taken verbatim.
To complete this test, you will need a test domain that you can add records to. It won't be modified otherwise.
This bug has to do with double-quotes at the start and end of TXT records. If your provider doesn't permit double-quotes in TXT records (you'd be surprised!) you don't have to worry about this bug because those records are banned in your auditrecords.go
file.
Log into your DNS provider's web UI (portal) and create these 4 TXT records. (Don't use DNSControl!) Yes, include the double-quotes on test 2 and 3!
Hostname | TXT |
---|---|
dnsconfig.js
Now in your dnsconfig.js
file, add these records to the domain:
When you do a dnscontrol preview
, you should see changes for t1 and t2.
If you don't see those changes, that's a bug. For example, we found that Cloudflare left t2 alone but would try to add double-quotes to t3! This was fixed in PR#1543.
Let's assume you DO see the changes. Push them using dnscontrol push
then check the webui to see that the changes are correct.
Refresh your provider's web UI and you should see the changes as expected: t1 should have double-quotes and t2 shouldn't. If the change wasn't correctly done, that's a bug.
Remove the lines from dnsconfig.js
and run dnscontrol push
to clean up.
t0
test0
t1
test1
t2
"test2"
t3
"test3"