Skip to content

Commit 35a5eed

Browse files
committed
ipip-462: document value format and security
1 parent be044ff commit 35a5eed

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/http-gateways/trustless-gateway.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ description: >
44
The minimal subset of HTTP Gateway response types facilitates data retrieval
55
via CID and ensures integrity verification, all while eliminating the need to
66
trust the gateway itself.
7-
date: 2023-06-20
7+
date: 2024-03-22
88
maturity: reliable
99
editors:
1010
- name: Marcin Rataj
1111
github: lidel
1212
url: https://lidel.org/
13+
affiliation:
14+
name: IP Shipyard
15+
url: https://ipshipyard.com
1316
- name: Henrique Dias
1417
github: hacdias
1518
url: https://hacdias.com/
19+
affiliation:
20+
name: IP Shipyard
21+
url: https://ipshipyard.com
1622
xref:
1723
- url
1824
- path-gateway
@@ -97,6 +103,21 @@ A Client SHOULD use it to send a relevant parent content path when:
97103
- fetching a big file block by block (`application/vnd.ipld.raw`)
98104
- parallelizing DAG download by fetching each branch sub-DAG as a CAR (`application/vnd.ipld.car`)
99105

106+
The value of `Ipfs-Path-Affinity` header SHOULD be percent-encoded
107+
([ECMA262: `encodeURIComponent`](https://tc39.es/ecma262/multipage/global-object.html#sec-encodeuricomponent-uricomponent))
108+
unless it meets the following conditions:
109+
- contains no path beyond the root identifier (`/ipfs/cid`)
110+
- contains no whitespace characters
111+
- contains no `:` characters
112+
- contains no non-ASCII characters
113+
114+
A gateway backend SHOULD leverage this hint to improve retrieval by querying
115+
providers of additional content paths in addition to the requested one.
116+
117+
Gateway implementation SHOULD support client requests with `Ipfs-Path-Affinity`
118+
header being present more than once, but also SHOULD set a hard limit of hints
119+
to process (e.g. 3) to avoid abuse.
120+
100121
## Request Query Parameters
101122

102123
### :dfn[dag-scope] (request query parameter)

src/ipips/ipip-0462.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ The client is in control when the affinity information is sent in the header,
6767
and an implementation SHOULD allow an end user to disable it in context where parent
6868
content path information is considered sensitive information.
6969

70+
Gateway implementation that supports `Ipfs-Path-Affinity` header being present
71+
more than once MUST also set limit (e.g. max 3) to avoid abuse.
72+
7073
### Alternatives
7174

7275
N/A

0 commit comments

Comments
 (0)