Skip to content

delegated routing: resolve DNSADDR addresses before filtering - #542

Merged
lidel merged 2 commits into
mainfrom
ipip-0527-resolve-dnsaddrs-before-filtering
Jul 29, 2026
Merged

delegated routing: resolve DNSADDR addresses before filtering#542
lidel merged 2 commits into
mainfrom
ipip-0527-resolve-dnsaddrs-before-filtering

Conversation

@achingbrain

Copy link
Copy Markdown
Member

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.

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.
@achingbrain achingbrain changed the title IPIP-527: Resolve DNSADDR addresses before filtering IPIP-542: Resolve DNSADDR addresses before filtering Jul 28, 2026
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

🚀 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 lidel changed the title IPIP-542: Resolve DNSADDR addresses before filtering delegated routing: resolve DNSADDR addresses before filtering Jul 29, 2026

@lidel lidel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more like a clarification of filtering mechanism (so LLMs make less mistakes) than spec change, so ok to merge without IPIP

go impl:

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
lidel merged commit 8a7e312 into main Jul 29, 2026
4 checks passed
@lidel
lidel deleted the ipip-0527-resolve-dnsaddrs-before-filtering branch July 29, 2026 15:37
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants