Build1 publisher3 min readPublished
A shared alias that outlived an offboarding passes the mailbox check onboarding treats as ownership
A dev.to walkthrough of FastAPI onboarding separates two proofs that codebases keep merging, one testing whether a person can read mail at a domain and the other whether anyone can write to its zone. Negative caching explains why the first check fails.
The Engineer · Build desk

What happened
- The dev.to post makes one question the first design decision: does the platform hold the customer's DNS zone, or does the customer? That boundary sets the record. It also sets the resolver and the retry schedule.
- Email confirmation answers whether the person in the signup flow can read mail at the domain. A forwarding rule or a shared alias that survived an offboarding satisfies it with no authority over the zone.
- Products that hand a tenant a subdomain on the platform's own zone and reuse the verification job get a passing TXT lookup. The platform's control plane wrote the record thirty seconds earlier.
- First attempts fail on negative caching, not propagation: a resolver may keep an earlier NXDOMAIN for the zone's SOA interval, and RFC 2308 recommends capping that at a few hours.
- The post draws the boundary at the registrable domain with the Public Suffix List and branches before querying, since counting labels breaks on co.uk and every other multi-label suffix.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
- exposure Onboarding that accepts either proof leaves a tenant's domain claim resting on whoever still receives mail at a role address, which the post says nobody notices until an ex-contractor's alias still resolves.
- constraint For names inside a zone the platform is authoritative for, ownership cannot be automated from DNS at all. Those tenants need a registrar contact, a contract, or a person to sign off.
- decision The zone-ownership question has to be answered before the verification code is written. The answer changes the record and the resolver, and the retry policy with them.
- cost Querying authoritative servers to dodge the cache moves the cost into DNS traffic: several lookups per attempt, repeated on every retry, against nameservers you do not run.
The token in the sample code needs no database. `expected_token()` HMACs the account id and the lowercased domain with a secret read from `DOMAIN_PROOF_SECRET`, then truncates the SHA-256 hexdigest to 32 characters [18][17]. Those 32 hex characters are 128 bits, half the digest [20]. Determinism per account and domain is what removes the token table [18]. It also means the secret cannot be rotated quietly: change `DOMAIN_PROOF_SECRET` and every record a customer already published stops matching [22].
`authoritative_resolver()` is where the cache gets bypassed. It calls `zone_for_name` on the domain, resolves the zone's NS set, resolves an A record for each nameserver, and returns a resolver built with `configure=False`, that nameserver list, and `lifetime = 5.0` [19]. For a zone listing two nameservers, that is four resolutions before anything asks for the TXT record [21]. The list is rebuilt inside the function, so every attempt pays those lookups again [26].
Take a zone publishing a one-hour negative TTL, inside the range the RFC recommends. A job polling every 30 seconds reads the same cached NXDOMAIN 120 times before the entry expires [23]. The customer, meanwhile, pasted the record into a dashboard forty seconds ago [27].
The post calls the platform-owned subdomain case "the one that passes code review and still fails in production" [9]. The lookup succeeds every time. That is why the branch has to happen before the query, at the registrable domain. For names inside a zone the platform is authoritative for, the remaining signals are a registrar contact, an out-of-band contract, or human review [12]. Where the name lives in the customer's zone, the post treats the TXT check as the strongest cheap evidence available [13].
The split between the two proofs has precedent in the standards. Neither standard mails anybody: DMARC publishes policy in a TXT record at `_dmarc` because writing there requires zone authority, and ACME's dns-01 challenge does the same at `_acme-challenge` [5]. Mailbox checks, in the post's framing, belong to inviting a teammate, confirming a billing contact, and recovering a locked account [6].
Re-verification is the piece the post opens on and then drops. Its first paragraph lists "what you do when the proof quietly disappears six months later" among the things the zone boundary decides [1]. The published text then works through the mailbox conflation, the self-signed subdomain and the negative cache before the code listing breaks off mid function [25]. The design does make a later check cheap, because the expected token is recomputed from the account id and the domain and nothing has to be stored [24]. In my view the Public Suffix List branch is the easy half of this; the re-check interval is the half that never gets a ticket. The label to look for is `_saas-verify` [17].
What to watch
- Whether the post publishes its fourth failure mode and states a re-check interval for a proof that has been deleted.
- Whether the sample code caches the NS and A lookups, or adds a fallback when a zone's authoritative servers do not answer inside the 5-second lifetime.
- Whether onboarding records the signal that verified each tenant, so a later audit can tell a TXT record from a registrar contact or a human review.