Skip to content

Commit 84cf27c

Browse files
use well-known providers/ instead of providers/{peerid}
1 parent 1bceec6 commit 84cf27c

File tree

1 file changed

+41
-42
lines changed

1 file changed

+41
-42
lines changed

src/ipips/ipip-0501.md

+41-42
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ tags: ['ipips']
2323
## Summary
2424

2525
This IPIP introduces a secure mechanism for advertising `/tls/http`
26-
multiaddresses in the Amino DHT. By requiring HTTP servers to host an empty
27-
file at the well-known path `.well-known/libp2p/amino/providers/{peerid}` for
28-
each authorized libp2p peer ID the DHT servers ensure that only providers
29-
safelisted by the HTTP server can advertise its content. This additional
30-
verification step mitigates potential DDoS attacks and prevents malicious
31-
actors from falsely claiming that HTTP server hosts content, while leaving
32-
existing libp2p records unaffected.
26+
multiaddresses in the Amino DHT. HTTP servers are now required to host a text
27+
file at the well-known path `.well-known/libp2p/amino/providers` listing the
28+
libp2p peer IDs of authorized providers. This verification step enables DHT
29+
servers to ensure that only approved providers can advertise content,
30+
mitigating potential DDoS attacks and preventing malicious actors from falsely
31+
asserting that an HTTP server hosts content, all while leaving existing libp2p
32+
records unchanged.
3333

3434
## Motivation
3535

@@ -64,49 +64,46 @@ into browsers, as browser development teams prioritize robust DDoS prevention.
6464

6565
## Detailed design
6666

67-
Providers advertising content hosted on an HTTP server MUST host an empty file
68-
for each libp2p peer ID authorized to advertise that HTTP server’s content to
69-
the Amino DHT at the [well-known
70-
location](https://www.rfc-editor.org/rfc/rfc8615)
71-
`.well-known/libp2p/amino/providers/{peerid}`. The existence of an empty file
72-
named of the the peer ID serves as the authorization marker. The filename peer
67+
Providers advertising content hosted on an HTTP server MUST host a text file at
68+
the [well-known location](https://www.rfc-editor.org/rfc/rfc8615)
69+
`.well-known/libp2p/amino/providers`. This file lists the libp2p peer IDs that are
70+
authorized to advertise that HTTP server’s content to the Amino DHT. Each peer
7371
ID MUST follow [string representation from Libp2p PeerID
7472
specification](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#string-representation)
75-
(base58btc multihash or CID with libp2p codec):
73+
(base58btc multihash or CID with libp2p codec), with one peer ID per line:
7674

7775
```
78-
.well-known/libp2p/amino/providers/12D3KooBase58MH
79-
.well-known/libp2p/amino/providers/k51KooBase36CID
76+
12D3KooBase58MH
77+
k51KooBase36CID
8078
```
8179

82-
By hosting these individual empty files, the HTTP server grants permission for
83-
the corresponding providers to advertise that the server hosts content
84-
identified by any CID.
80+
By listing these peer IDs, the HTTP server grants permission for the
81+
corresponding providers to advertise that the server hosts content identified
82+
by any CID.
8583

86-
When a DHT server receives an `ADD_PROVIDER` RPC from a given `peerID` that
87-
includes `/tls/http` multiaddresses, it MUST verify the existence of the file
88-
at `.well-known/libp2p/amino/provider/peerID` on the advertised HTTP server by
89-
issuing an HTTP HEAD request for each `/tls/http` address. If the HTTP HEAD
90-
request does not return a `200` response, the DHT server MUST NOT associate
91-
that `/tls/http` address with the provider record.
84+
When a DHT Server receives an `ADD_PROVIDER` RPC that includes `/tls/http`
85+
multiaddresses, it MUST verify that the provider’s peer ID is listed in the
86+
file located at `.well-known/libp2p/amino/providers` on the advertised HTTP
87+
server, for all `/tls/http` addresses. If the peer ID is not found, the server
88+
MUST NOT associate that `/tls/http` address with the provider record.
9289

9390
DHT Servers SHOULD cache the resolved mapping of each `/tls/http` multiaddress
9491
to its peer IDs for the duration of the `ReprovideInterval` to minimize
95-
repetitive HTTP HEAD requests. Additionally, for addresses that fail
96-
verification, a negative cache entry SHOULD be maintained for 15 minutes to
92+
repetitive HTTP GET requests. Additionally, for addresses that fail
93+
verification, a negative cache entry SHOULD be maintained for `15` minutes to
9794
reduce unnecessary load and mitigate potential abuse.
9895

9996
## Design rationale
10097

10198
* **Lightweight Verification:** Each HTTP server only answers approximately one
102-
HEAD request per DHT Server per `ReprovideInterval`, regardless of the number
99+
GET request per DHT Server per `ReprovideInterval`, regardless of the number
103100
of CIDs being advertised.
104101
* **Revocation Considerations:** If a provider revokes a peer ID, the
105102
previously published records will persist until the next reprovide cycle. Thus,
106103
a cache duration equal to the `ReprovideInterval` is appropriate.
107104
* **Negative Caching:** A 15-minute negative cache prevents malicious actors
108-
from triggering repeated HEAD requests, as the cost of generating a DHT provide
109-
request is higher than that of performing an HTTP HEAD, mitigating
105+
from triggering repeated GET requests, as the cost of generating a DHT provide
106+
request is higher than that of performing an HTTP GET, mitigating
110107
amplification attacks.
111108

112109
### User benefit
@@ -127,7 +124,7 @@ record.
127124

128125
Given that there are currently around 10k DHT servers in the Amino DHT
129126
([source](https://web.archive.org/web/20250404174746/https://probelab.io/ipfs/amino/#dht-availability-classified-overall-plot)),
130-
the HTTP server is expected to receive roughly 10k HEAD requests every
127+
the HTTP server is expected to receive roughly 10k GET requests every
131128
`ReprovideInterval`, one from each DHT server.
132129

133130
Around 300k libp2p clients interact with the Amino DHT on a daily basis
@@ -161,7 +158,7 @@ expected from current providers.
161158

162159
The same verification mechanism could be used by other content routing systems,
163160
such as IPNI. For more control, it is recommended that each content routing
164-
system use a dedicated path, e.g `.well-known/libp2p/ipni/provider/{peerid}`
161+
system use a dedicated path, e.g `.well-known/libp2p/ipni/providers`
165162
for IPNI.
166163

167164
### Security
@@ -229,7 +226,7 @@ it lacks a "server-only" authentication option. While mutual authentication
229226
could be halted after the server responds with an HTTP 401 status and includes
230227
its own PeerID in the HTTP header, this approach introduces notable challenges:
231228

232-
* It increases complexity, requiring not just a standard HTTP HEAD request but
229+
* It increases complexity, requiring not just a standard HTTP GET request but
233230
also the implementation of a custom Authorization header workflow.
234231
* It restricts the HTTP server to representing only a single PeerID, preventing
235232
the sharding of announcements across multiple PeerIDs and thus making
@@ -252,16 +249,18 @@ even years for full adoption by DHT servers. In addition, if other applications
252249
begin using this generic file, DHT servers may end up retrieving unnecessary
253250
extra information.
254251

255-
#### Single `.well-known/libp2p/amino/providers` file
252+
#### Flat `.well-known/libp2p/amino/providers/{peerid}` empty files
256253

257-
An alternative approach is to consolidate all authorized peer IDs into a single
258-
file located at `.well-known/libp2p/amino/providers` instead of using separate
259-
files at `.well-known/libp2p/amino/providers/{peerid}`. However, this method
260-
has drawbacks. DHT servers would need to download more data than they would
261-
with a simple HTTP HEAD request. Additionally, they cannot benefit from caching
262-
all addresses contained in the `.well-known/libp2p/amino/providers` at once,
263-
because they should only cache addresses used by an actual DHT node to avoid
264-
caching an unbounded number of peer IDs.
254+
An alternative approach is to host an empty file for each authorized provider
255+
peer ID at `./well-known/libp2p/amino/providers/{peerid}`. This approach allows
256+
for HTTP HEAD requests instead of GET requests, which is more efficient on the
257+
wire.
258+
259+
However, this method doesn't support the different [string representation
260+
from the Libp2p PeerID
261+
specification](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#string-representation)
262+
and would lead to false negatives if the DHT server looks for another
263+
string representation than the one used on the HTTP server.
265264

266265
#### Reuse `did:web` Method Specification
267266

0 commit comments

Comments
 (0)