ADR-0048: DNS-over-HTTPS for this zone only, from its own nameservers#
- Status: proposed
- Date: 2026-12-01
Context#
The roadmap's DoH endpoint (RFC 8484) would be the first here to parse anyone's input. It must not become an open resolver billed to the account, and it meets the AWS WAF Hold condition, which ADR-0009 says to settle first. Principle 10 prefers data to code, and build time to run time.
The apex's address and HTTPS records are aliases Route 53 resolves as it answers, so state does not hold them, and Route 53 signs online.
Decision#
- Scope. The name must be
testz.devor end in.testz.dev, compared by label, ignoring case; class IN; a type the zone serves, from state, or DNSKEY or DS. Anything else getsREFUSED(RCODE 5), an authoritative server's answer for a zone it does not serve.NXDOMAINwould deny real names;SERVFAILinvites retries. Nothing recurses. - Answers come from the zone's nameservers. A new function, not
/api/whoami(ADR-0045 relies on it taking no input), sends the zone's Route 53 nameservers, named from state as in ADR-0027, a fresh query over TCP carrying only the question and DO bit, and relays the answer with only the ID changed. Its RRSIGs validate without trusting this endpoint: DoH hides the question from the network, DNSSEC makes authenticity independent of the server. One owner runs both, so this demonstrates rather than protects. - Input.
GET /dns-query?dns=only, base64url, at most 683 characters (512 bytes). A standard-library parser reads header and question only: QR clear; opcode QUERY, elseNOTIMP; one question; no answer or authority records; at most one OPT record, read for DO alone; no compression; no trailing bytes. Anything malformed gets HTTP 400 and reaches no nameserver. CloudFront refuses POST: through origin access control it needs the client to send its body's SHA-256, which DoH clients do not. RFC 8484 requires both; this departs knowingly. - Shown to fail.
make test-dohruns hostile cases, each failing when its fault returns: truncation, bad counts, compression pointers, over-long names, trailing bytes, bad base64,eviltestz.dev, ANY, AXFR; and seeded random bytes, which may yield only a 400, a refusal or an in-scope question. - Cost. Reserved concurrency 2, 128 MB arm64, 3-second timeout. The account's concurrency quota is checked before building; if it cannot reserve 2, the apply fails rather than ship uncapped. The cache key is
dnsalone; max-age is the smallest TTL, at most 300 seconds. The cap bounds duration at about $3.30 a month beyond the free tier, not requests: a flood beyond the free tiers costs about $1.20 per million, $1.00 of it CloudFront's, as on any path, unless a flat-rate plan is adopted (ADR-0049). Steady state: $0.00; the $5 budget is the tripwire. - AWS WAF stays on Hold, for the reasons in ADR-0049.
- Placement. Its own host,
doh.testz.dev, and distribution, as in ADR-0045: TLS 1.3 only, the function its only origin, the host on the site's certificate. A mistake there cannot reach the apex's paths. - Privacy. The function logs no question, answer or address, and ignores the viewer address CloudFront forwards, passing on no Client Subnet. What remains: Lambda's duration lines for 14 days, and cached public answers. Access and query logging stay off.
- Verified from outside. The health check's SOA query with DO must get 200,
application/dns-message,NOERROR, an RRSIG and the serial the nameservers give directly;example.commust getREFUSED; a malformed query, 400. Stub servers show each line failing. - Grants. The function writes only its logs. The apply role gains the reserved-concurrency actions, through the bootstrap layer first.
Alternatives considered#
Records from state, at apply time. Least surface, but no alias answers, no signatures, and a second copy of the zone.
UDP to the nameservers. A truncated answer needs a TCP retry anyway, and UDP is easier to spoof.
Route 53's TestDNSAnswer. No RRSIGs, a new grant, and an API rate-limited per account, so a flood would throttle applies.
A path on the site's distribution, as ADR-0002 foresaw. Every change touches the apex's distribution, and a misordered behaviour could route its paths here.
Consequences#
Positive: signed answers over HTTPS anyone can check, with no data store.
Negative: the first code here parsing anyone's input. Without POST, curl's --doh-url cannot use it. A flood takes it, not the site, offline. Another distribution and certificate replacement. A check target, retiring nothing (ADR-0029).
Neutral: the apex is unchanged.
Revisit when#
- A flat-rate plan is adopted for its distribution, or a flood arrives.
- Answering beyond this zone: a new ADR, and WAF again.
- Origin access control accepts POST without a client-computed hash.
- A parser bug ships.