delegated routing: resolve DNSADDR addresses before filtering - #542
Merged
Conversation
Delegated HTTP Routing clients can specify address filters to limit returned providers to ones that listen on transports supported by the client. `DNSADDR` addresses are a special case in that they can resolve to multiple addresses that may contain tuples from the filter, and the starting address is not likely to contain them. This IPIP suggests adding a line to the spec that reminds the implementer they should resolve `DNSADDR` addresses to the final set before applying any address filters as otherwise valid, dialable providers would be omitted from the response.
🚀 Build Preview on IPFS ready
|
lidel
added a commit
to ipfs/someguy
that referenced
this pull request
Jul 29, 2026
A /dnsaddr carries no transport component, so filter-addrs can neither match it nor exclude it: a ws-speaking peer was dropped by ?filter-addrs=ws, and a quic-only peer survived ?filter-addrs=!quic-v1. Neither is detectable by the client. someguy now resolves before boxo filters, which fixes both directions. See ipfs/specs#542. A filtered request has its /dnsaddr replaced, since keeping it would let a record survive a filter meant to exclude it. The exception is a positive filter naming dnsaddr, the one filter a /dnsaddr matches; the client is asking for indirections, so the /dnsaddr is kept alongside what it resolves to. An unfiltered request gets the resolved addresses added and keeps the /dnsaddr, so it can dial now and re-resolve later. SOMEGUY_DNSADDR_RESOLUTION names what an unfiltered response does with the /dnsaddr: append (default), replace, filtered, or never. Hostnames in provider records are attacker-chosen, and resolution runs inline while the response streams, so it is bounded on four axes: DNS lookups per request, resolved addresses per record, recursion depth, and a per-lookup timeout, which together also cap the delay resolution can add to one response. The per-record limit is threaded through the recursion rather than applied to the finished result: a TXT record that lists itself expands as fan^depth, and re-entering a cached name costs no lookup, so a limit checked at the end still let one request build millions of addresses. - resolve detached from the request context behind a singleflight, so a disconnect cannot cache its own cancellation as a 15 minute failure - shed load once the request is gone rather than spend the rest of its budget on queries nothing will read - keep the original whenever an expansion is not whole, so a failed or throttled lookup does not drop the indirection the rest lives behind - drop a /dnsaddr naming a different peer: nothing it yields can belong to the record carrying it - normalize only the hostname in cache keys, over ASCII: lowering a whole multiaddr folds case-sensitive components together, and Unicode case mapping folds U+0130 and U+212A onto ASCII, which let one record cache a failure under another name's key - skip lookups madns can never satisfy, such as a /p2p-circuit suffix - order addresses by how directly they dial: IP, DNS, dnsaddr, relay last - require go 1.26
lidel
added a commit
to ipfs/someguy
that referenced
this pull request
Jul 29, 2026
A /dnsaddr carries no transport component, so filter-addrs can neither match it nor exclude it: a ws-speaking peer was dropped by ?filter-addrs=ws, and a quic-only peer survived ?filter-addrs=!quic-v1. Neither is detectable by the client. someguy now resolves before boxo filters, which fixes both directions. See ipfs/specs#542. A filtered request has its /dnsaddr replaced, since keeping it would let a record survive a filter meant to exclude it. The exception is a positive filter naming dnsaddr, the one filter a /dnsaddr matches; the client is asking for indirections, so the /dnsaddr is kept alongside what it resolves to. An unfiltered request gets the resolved addresses added and keeps the /dnsaddr, so it can dial now and re-resolve later. SOMEGUY_DNSADDR_RESOLUTION names what an unfiltered response does with the /dnsaddr: append (default), replace, filtered, or never. Hostnames in provider records are attacker-chosen, and resolution runs inline while the response streams, so it is bounded on four axes: DNS lookups per request, resolved addresses per record, recursion depth, and a per-lookup timeout, which together also cap the delay resolution can add to one response. The per-record limit is threaded through the recursion rather than applied to the finished result: a TXT record that lists itself expands as fan^depth, and re-entering a cached name costs no lookup, so a limit checked at the end still let one request build millions of addresses. - resolve detached from the request context behind a singleflight, so a disconnect cannot cache its own cancellation as a 15 minute failure - shed load once the request is gone rather than spend the rest of its budget on queries nothing will read - keep the original whenever an expansion is not whole, so a failed or throttled lookup does not drop the indirection the rest lives behind - drop a /dnsaddr naming a different peer: nothing it yields can belong to the record carrying it - normalize only the hostname in cache keys, over ASCII: lowering a whole multiaddr folds case-sensitive components together, and Unicode case mapping folds U+0130 and U+212A onto ASCII, which let one record cache a failure under another name's key - skip lookups madns can never satisfy, such as a /p2p-circuit suffix - order addresses by how directly they dial: IP, DNS, dnsaddr, relay last - require go 1.26
lidel
approved these changes
Jul 29, 2026
Uses the RFC 2119 keyword, and spells out that the original /dnsaddr multiaddr stays in the resolved set so a client asking for ?filter-addrs=dnsaddr still gets it back. Bumps the date.
lidel
approved these changes
Jul 29, 2026
lidel
added a commit
to ipfs/someguy
that referenced
this pull request
Jul 29, 2026
A /dnsaddr carries no transport component, so filter-addrs can neither match it nor exclude it: a ws-speaking peer was dropped by ?filter-addrs=ws, and a quic-only peer survived ?filter-addrs=!quic-v1. Neither is detectable by the client. someguy now resolves before boxo filters, which fixes both directions. See ipfs/specs#542. A filtered request has its /dnsaddr replaced, since keeping it would let a record survive a filter meant to exclude it. The exception is a positive filter naming dnsaddr, the one filter a /dnsaddr matches; the client is asking for indirections, so the /dnsaddr is kept alongside what it resolves to. An unfiltered request gets the resolved addresses added and keeps the /dnsaddr, so it can dial now and re-resolve later. SOMEGUY_DNSADDR_RESOLUTION names what an unfiltered response does with the /dnsaddr: append (default), replace, filtered, or never. Hostnames in provider records are attacker-chosen, and resolution runs inline while the response streams, so it is bounded on four axes: DNS lookups per request, resolved addresses per record, recursion depth, and a per-lookup timeout, which together also cap the delay resolution can add to one response. The per-record limit is threaded through the recursion rather than applied to the finished result: a TXT record that lists itself expands as fan^depth, and re-entering a cached name costs no lookup, so a limit checked at the end still let one request build millions of addresses. - resolve detached from the request context behind a singleflight, so a disconnect cannot cache its own cancellation as a 15 minute failure - shed load once the request is gone rather than spend the rest of its budget on queries nothing will read - keep the original whenever an expansion is not whole, so a failed or throttled lookup does not drop the indirection the rest lives behind - drop a /dnsaddr naming a different peer: nothing it yields can belong to the record carrying it - normalize only the hostname in cache keys, over ASCII: lowering a whole multiaddr folds case-sensitive components together, and Unicode case mapping folds U+0130 and U+212A onto ASCII, which let one record cache a failure under another name's key - skip lookups madns can never satisfy, such as a /p2p-circuit suffix - order addresses by how directly they dial: IP, DNS, dnsaddr, relay last - require go 1.26 - ipfs/specs#542
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Delegated HTTP Routing clients can specify address filters to limit returned providers to ones that listen on transports supported by the client.
DNSADDRaddresses are a special case in that they can resolve to multiple addresses that may contain tuples from the filter, and the starting address is not likely to contain them.This IPIP suggests adding a line to the spec that reminds the implementer they should resolve
DNSADDRaddresses to the final set before applying any address filters as otherwise valid, dialable providers would be omitted from the response.