Skip to content

Commit

Permalink
chore: apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel authored May 18, 2023
1 parent 04563ac commit cb84b24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion IPIP/0337-delegated-routing-http-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ To understand the design rationale, it is important to consider the concrete Ref
So this API proposal makes the following changes:

- The Delegated Content Routing API is defined using HTTP semantics, and can be implemented without introducing Reframe concepts nor IPLD
- There is a clear distinction between the RPC protocol (HTTP) and the API (Delegated Content Routing)
- There is a clear distinction between the [Kubo RPC](https://docs.ipfs.tech/reference/kubo/rpc/) and the vendor-agnostic Routing V1 HTTP API (introduced in [IPIP-377](https://specs.ipfs.tech/ipips/ipip-0337/).
- "Method names" and cache-relevant parameters are pushed into the URL path
- Streaming support is removed, and default response size limits are added.
- We will add streaming support in a subsequent IPIP, but we are trying to minimize the scope of this IPIP to what is immediately useful
Expand Down
18 changes: 7 additions & 11 deletions IPIP/0379-delegated-ipns-http-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The rationale for delegated IPNS over HTTP APIs closely follows the reasoning li
The document proposes the following:
- Use of HTTP semantics for publication and resolution of naming records.
- Preference for human-readable request and response encoding, such as JSON format
- Optional backward compatibility support for the existing ProtocolBuffer format using `Content-Type: application/vnd.ipfs.ipns-record`
- Mandatory support for the existing [IPNS Record serialization format](https://specs.ipfs.tech/ipns/ipns-record/#record-serialization-format) using `Content-Type: application/vnd.ipfs.ipns-record`
- Use of extra headers in `OPTIONS` response to communicate the supported capabilities and limitations, namely:
- `X-Ipns-Allow-Max-Size` -- to signal maximum supported IPNS record size
- `X-Ipns-Allow-Protobuf` -- to signal whether the server supports ProtocolBuffer formatted records.
Expand All @@ -42,28 +42,24 @@ The ability of offload naming onto another process or server via an idiomatic an

##### Serialization Format

IPNS records use [ProtocolBuffer serialisation format](../ipns/IPNS.md#record-serialization-format).
IPNS records use [`application/vnd.ipfs.ipns-record` protobuf serialization format](https://specs.ipfs.tech/ipns/ipns-record/#record-serialization-format).
This format is widely in use in IPNS over PubSub and DHT routing systems.
One of the motivations of this document is to introduce simple to use HTTP APIs and ultimately reduce barrier for interaction across alternative systems.
Further, interoperability across the existing and HTTP APIs is also desirable in order to reduce the barrier for adoption of the delegated HTTP APIs.

The specification here maintains backwards compatibility in terms of record serialisation, with preference for human-readable formats such as JSON.
To maximize interoperability with existing ecosystem, the canonical [IPNS record serialization format](../ipns/IPNS.md#record-serialization-format) (`0x0300`) can be requested with content type `application/vnd.ipfs.ipns-record`.
To maximize interoperability with existing ecosystem, the canonical [IPNS record serialization format](https://specs.ipfs.tech/ipns/ipns-record/#record-serialization-format) (`0x0300`) can be requested with content type `application/vnd.ipfs.ipns-record`.

##### Reframe
#### Compatibility

See [IPIP-337/Backwards Compatibility](0337-delegated-routing-http-api.md#backwards-compatibility).

#### Forwards Compatibility

See [IPIP-337/Forwards Compatibility](0337-delegated-routing-http-api.md#forwards-compatibility).
See [IPIP-337/Compatibility](https://specs.ipfs.tech/ipips/ipip-0337/#compatibility).

### Security

All interaction over the APIs should use TLS to protect against third-party observation and tampering.
Additionally, the IPNS records are signed by the publisher's identity and contain sequence number to avoid replay attacks.
Additionally, the IPNS records must be [validated according to the rules stated in the IPNS spec](https://specs.ipfs.tech/ipns/ipns-record/#record-verification) before further processing.

To avoid Denial of Service attack, maximum IPNS record size of `10 KiB` applies.
To avoid Denial of Service attack, [maximum IPNS record size defined in IPNS spec](https://specs.ipfs.tech/ipns/ipns-record/#record-size-limit) applies.
Implements are permitted to set a lower limit. If lower than the default maximum, the limit should be discoverable via `OPTIONS` request with header key `X-Ipns-Allow-Max-Size` with value specified as the number of bytes.

Similarly, a client may check if a server supports ProtocolBuffer formatted records by checking the `X-Ipns-Allow-Protobuf` header key in response to `OPTIONS` request. If present the header value must be either `true` or `false` the absence of the header indicates that ProtocolBuffer formatted records are not supported.
Expand Down

0 comments on commit cb84b24

Please sign in to comment.