I got a namesilo domain to test and fix this: trailing dots in MX, CNAME, SRV, NS - #8
Open
coolaj86 wants to merge 2 commits into
Open
I got a namesilo domain to test and fix this: trailing dots in MX, CNAME, SRV, NS#8coolaj86 wants to merge 2 commits into
coolaj86 wants to merge 2 commits into
Conversation
gofmt/goimports always normalize to LF (Go issue #16355). Add .gitattributes with text=auto so Git stores LF in the repo to match, preventing spurious diffs for future contributors.
The Namesilo API rejects FQDNs with trailing dots on hostname targets,
returning: "Field 'Target hostname' should be valid. Please use only
letters (A-Z, case-insensitive), numbers (0-9), and hyphens (-)."
The libdns convention is that callers pass FQDNs with trailing dots
(e.g. "10 mail.example.com."). Every other libdns provider normalizes
trailing dots for its API -- Cloudflare, Namecheap, and NFSN all do
this. The namesilo provider had no such normalization, and its tests
only used CNAME data without trailing dots ("wikipedia.com"), so the
bug was never caught.
This strips trailing dots from:
- MX exchange target (fields[1])
- SRV target (fields[3])
- CNAME, NS, ALIAS, PTR record data
- findRecordId comparison (so DeleteRecords matches stored values)
Adds TestTrailingDotTargets which creates CNAME, MX, and SRV records
with trailing dots on unique subdomain names (testtdcname, testtdmx,
_testtd._tcp), verifies they exist, then deletes them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The API requires that trailing dots be stripped, but the test was testing with the dot already stripped. This makes sure that trailing dots are normalized for use in the API and comparison.
This specific change is: 6de202c
Stacked on #7 due to the line ending issues.