Skip to content

fix: Correct MX value docs and validate admin record names#235

Merged
ZPascal merged 1 commit into
mainfrom
handle-mx-value-issue
Jul 11, 2026
Merged

fix: Correct MX value docs and validate admin record names#235
ZPascal merged 1 commit into
mainfrom
handle-mx-value-issue

Conversation

@ZPascal

@ZPascal ZPascal commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • README documented MX record values as a bare hostname, but the DNS spec (and this codebase's own probeRR validation via dns.NewRR) requires a preference before the exchange host, e.g. 10 mail.example.com.. Following the old docs made every MX creation fail with invalid_record_value. Docs are now corrected, and the previously untested MX create → serve path has test coverage (TestAdminCreateMXRecord, TestAnswerManagedMXRecord) proving the existing validation/serving logic was already correct.
  • Hardened admin record name validation: adminCreateRecord/adminUpdateRecord previously only rejected an empty name, so a name containing whitespace or control characters (e.g. a newline) would be stored and later spliced unescaped into the RR string built for DNS responses. Added validRecordName (label length/charset checks, blocks whitespace/newlines, allows _-prefixed labels and wildcard *) and wired it into both handlers.

Test plan

  • go build ./...
  • go vet ./...
  • go test ./...

@ZPascal ZPascal force-pushed the handle-mx-value-issue branch 2 times, most recently from aded3cd to 1ec26fe Compare July 11, 2026 12:02
@ZPascal ZPascal changed the title Handle mx value issue fix: Correct MX value docs and validate admin record names Jul 11, 2026
@ZPascal ZPascal force-pushed the handle-mx-value-issue branch 2 times, most recently from 86658e5 to c13ed87 Compare July 11, 2026 12:54
@ZPascal ZPascal marked this pull request as ready for review July 11, 2026 12:54
@ZPascal ZPascal force-pushed the handle-mx-value-issue branch from c13ed87 to ba290f3 Compare July 11, 2026 13:30
@ZPascal ZPascal force-pushed the handle-mx-value-issue branch from ba290f3 to 92b75c2 Compare July 11, 2026 13:43
@ZPascal ZPascal merged commit afb8639 into main Jul 11, 2026
6 checks passed
@ZPascal ZPascal deleted the handle-mx-value-issue branch July 11, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant