Fix four shipping defects !3

merged merged by cmc on 2026-10-24 03:19 UTC · krz/domain-dig:shipping-defects into cleanup

Discussion

cmc

Four defects found in review. Each commit stands alone.

Availability could never report "available." RDAPService.registrationStatus mapped a 404 to nil and DomainAvailabilityService rewrote a DNS-derived .registered to .unknown, so nothing produced .available. The badge, suggestions, insight engine, diff service, exporters and audit views all rendered a case that never arrived. A 404 from rdap.org is now read as unregistered only when the registry's own server answered it, which the response URL's host tells us because URLSession follows the bootstrap redirect. The DNS fallback keeps its .registered result; it still cannot report available, because the DoH layer drops the response code and NXDOMAIN is indistinguishable from a resolver failure there.

A space in the domain crashed the app. URL(string: "https://exa mple.com") is nil and three services built their request with !. Nothing validates the input, so example .com or space-separated bulk input was enough. DomainHostURL returns nil and the services report a section error instead.

The Info.plist ATS keys were inert — Xcode's display names with zero-width spaces in them, so NSAppTransportSecurity was absent and default ATS applied. The http fallback in RedirectChainService could not connect, which is the hop the redirect check exists to show.

"Plain" SMTP sent credentials in the clear. AUTH LOGIN over NWParameters.tcp is base64, not encryption, and the editor requires a password, so every email integration had credentials to leak. SMTPClient now throws before connecting, the editor says so at save time, and the mode reads "None (no TLS)".

Tests: 81 pass (14 new, covering DomainHostURL and the registry-origin check). The .available network path and the SMTP guard have no coverage — RDAPService and SMTPClient have no injectable transport.

Not addressed, both still open from the same review: STARTTLS, so port 587 submission still cannot work; and no syntax validation on the domain input, so nonsense still runs the full pipeline and returns section errors.