@@ -23,13 +23,13 @@ tags: ['ipips']
23
23
## Summary
24
24
25
25
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 .
33
33
34
34
## Motivation
35
35
@@ -64,49 +64,46 @@ into browsers, as browser development teams prioritize robust DDoS prevention.
64
64
65
65
## Detailed design
66
66
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
73
71
ID MUST follow [ string representation from Libp2p PeerID
74
72
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 :
76
74
77
75
```
78
- .well-known/libp2p/amino/providers/ 12D3KooBase58MH
79
- .well-known/libp2p/amino/providers/ k51KooBase36CID
76
+ 12D3KooBase58MH
77
+ k51KooBase36CID
80
78
```
81
79
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.
85
83
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.
92
89
93
90
DHT Servers SHOULD cache the resolved mapping of each ` /tls/http ` multiaddress
94
91
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
97
94
reduce unnecessary load and mitigate potential abuse.
98
95
99
96
## Design rationale
100
97
101
98
* ** 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
103
100
of CIDs being advertised.
104
101
* ** Revocation Considerations:** If a provider revokes a peer ID, the
105
102
previously published records will persist until the next reprovide cycle. Thus,
106
103
a cache duration equal to the ` ReprovideInterval ` is appropriate.
107
104
* ** 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
110
107
amplification attacks.
111
108
112
109
### User benefit
@@ -127,7 +124,7 @@ record.
127
124
128
125
Given that there are currently around 10k DHT servers in the Amino DHT
129
126
([ 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
131
128
` ReprovideInterval ` , one from each DHT server.
132
129
133
130
Around 300k libp2p clients interact with the Amino DHT on a daily basis
@@ -161,7 +158,7 @@ expected from current providers.
161
158
162
159
The same verification mechanism could be used by other content routing systems,
163
160
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 `
165
162
for IPNI.
166
163
167
164
### Security
@@ -229,7 +226,7 @@ it lacks a "server-only" authentication option. While mutual authentication
229
226
could be halted after the server responds with an HTTP 401 status and includes
230
227
its own PeerID in the HTTP header, this approach introduces notable challenges:
231
228
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
233
230
also the implementation of a custom Authorization header workflow.
234
231
* It restricts the HTTP server to representing only a single PeerID, preventing
235
232
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
252
249
begin using this generic file, DHT servers may end up retrieving unnecessary
253
250
extra information.
254
251
255
- #### Single ` .well-known/libp2p/amino/providers ` file
252
+ #### Flat ` .well-known/libp2p/amino/providers/{peerid} ` empty files
256
253
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.
265
264
266
265
#### Reuse ` did:web ` Method Specification
267
266
0 commit comments