perf: handle resolution waits for the HTTPS well-known even when DNS has answered #193
Labels
No labels
breaking-change
bug
documentation
duplicate
enhancement
good first issue
help wanted
performance
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Grandiras/ATProto.NET#193
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
HandleResolver.ResolveAsyncwaits for both the DNS TXT lookup and the HTTPS well-known to finish, so that it can fail closed when they disagree. For the many handles configured through DNS, that means every resolution waits for the handle's web host to answer (usually with a 404), even though DNS answered long before.Measured against the live network (warm connections):
A web host that drops packets holds every resolution for the full
HandleResolutionTimeout(5 s), although DNS has answered.Proposal
Follow the spec's resolution best practice: run both lookups concurrently and take the first answer, with DNS TXT preferred. A DNS answer returns at once and cancels the HTTPS lookup; the HTTPS answer is used only when DNS has none. Two distinct
did=values in DNS still fail withHandleConflict.DNS control already implies control of the domain (it can obtain a certificate for it), so preferring DNS gives an attacker nothing the current policy denies them.
Not implementing this autonomously: removing the fail-closed DNS/HTTPS conflict check is a security-relevant policy change. The spec allows it ("use the first successful result … DNS TXT should be preferred"), and it would cut DNS-configured handles from roughly 125–190 ms to ~25 ms, but it needs the owner's call. The latency work that keeps the policy is in a separate issue.