Skip to content

Commit 7e032af

Browse files
committed
feat: add content size limit flags
Wire boxo gateway size limit options as CLI flags: - --max-deserialized-response-size / RAINBOW_MAX_DESERIALIZED_RESPONSE_SIZE - --max-unixfs-dag-response-size / RAINBOW_MAX_UNIXFS_DAG_RESPONSE_SIZE Both disabled by default (0). When set, content exceeding the limit returns 501 directing users to run their own IPFS node. Depends on ipfs/boxo#1138.
1 parent 17ab6b4 commit 7e032af

File tree

6 files changed

+104
-84
lines changed

6 files changed

+104
-84
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ The following emojis are used to highlight certain changes:
1616
### Added
1717

1818
- Add `--max-request-duration` CLI flag (`RAINBOW_MAX_REQUEST_DURATION` env var) to configure the Boxo gateway `MaxRequestDuration` option. Defaults to 1 hour, matching Boxo's DefaultMaxRequestDuration. ([#350](https://github.com/ipfs/rainbow/pull/350))
19+
- Add `--max-deserialized-response-size` (`RAINBOW_MAX_DESERIALIZED_RESPONSE_SIZE`) to limit deserialized responses by content size. Trustless formats (raw, CAR) are not affected. ([#362](https://github.com/ipfs/rainbow/pull/362))
20+
- Add `--max-unixfs-dag-response-size` (`RAINBOW_MAX_UNIXFS_DAG_RESPONSE_SIZE`) to limit all response formats by UnixFS DAG size, including raw blocks, CAR, and TAR. ([#362](https://github.com/ipfs/rainbow/pull/362))
1921

2022
### Changed
2123

go.mod

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/felixge/httpsnoop v1.0.4
1212
github.com/ipfs-shipyard/nopfs v0.0.14
1313
github.com/ipfs-shipyard/nopfs/ipfs v0.25.0
14-
github.com/ipfs/boxo v0.37.0
14+
github.com/ipfs/boxo v0.38.1-0.20260410154837-50371cdb05ea
1515
github.com/ipfs/go-block-format v0.2.3
1616
github.com/ipfs/go-cid v0.6.0
1717
github.com/ipfs/go-datastore v0.9.1
@@ -31,7 +31,7 @@ require (
3131
github.com/libp2p/go-libp2p-routing-helpers v0.7.5
3232
github.com/libp2p/go-libp2p-testing v0.12.0
3333
github.com/mitchellh/go-server-timing v1.0.1
34-
github.com/mr-tron/base58 v1.2.0
34+
github.com/mr-tron/base58 v1.3.0
3535
github.com/multiformats/go-multiaddr v0.16.1
3636
github.com/multiformats/go-multiaddr-dns v0.5.0
3737
github.com/multiformats/go-multicodec v0.10.0
@@ -47,8 +47,8 @@ require (
4747
go.opentelemetry.io/otel v1.42.0
4848
go.opentelemetry.io/otel/sdk v1.42.0
4949
go.opentelemetry.io/otel/trace v1.42.0
50-
golang.org/x/crypto v0.48.0
51-
golang.org/x/sys v0.41.0
50+
golang.org/x/crypto v0.49.0
51+
golang.org/x/sys v0.42.0
5252
)
5353

5454
require (
@@ -98,19 +98,19 @@ require (
9898
github.com/google/gopacket v1.1.19 // indirect
9999
github.com/google/uuid v1.6.0 // indirect
100100
github.com/gorilla/websocket v1.5.3 // indirect
101-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect
101+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
102102
github.com/hashicorp/golang-lru v1.0.2 // indirect
103103
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
104104
github.com/huin/goupnp v1.3.0 // indirect
105-
github.com/ipfs/bbloom v0.0.4 // indirect
105+
github.com/ipfs/bbloom v0.1.0 // indirect
106106
github.com/ipfs/go-bitfield v1.1.0 // indirect
107107
github.com/ipfs/go-cidutil v0.1.1 // indirect
108108
github.com/ipfs/go-dsqueue v0.2.0 // indirect
109109
github.com/ipfs/go-ipfs-pq v0.0.4 // indirect
110110
github.com/ipfs/go-ipfs-redirects-file v0.1.2 // indirect
111111
github.com/ipfs/go-ipld-cbor v0.2.1 // indirect
112112
github.com/ipfs/go-ipld-format v0.6.3 // indirect
113-
github.com/ipfs/go-ipld-legacy v0.2.2 // indirect
113+
github.com/ipfs/go-ipld-legacy v0.3.0 // indirect
114114
github.com/ipfs/go-peertaskqueue v0.8.3 // indirect
115115
github.com/ipld/go-car/v2 v2.16.0 // indirect
116116
github.com/ipld/go-ipld-prime v0.22.0 // indirect
@@ -142,7 +142,7 @@ require (
142142
github.com/multiformats/go-base32 v0.1.0 // indirect
143143
github.com/multiformats/go-base36 v0.2.0 // indirect
144144
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
145-
github.com/multiformats/go-multibase v0.2.0 // indirect
145+
github.com/multiformats/go-multibase v0.3.0 // indirect
146146
github.com/multiformats/go-multihash v0.2.3 // indirect
147147
github.com/multiformats/go-multistream v0.6.1 // indirect
148148
github.com/multiformats/go-varint v0.1.0 // indirect
@@ -196,10 +196,10 @@ require (
196196
go.opentelemetry.io/contrib/propagators/b3 v1.42.0 // indirect
197197
go.opentelemetry.io/contrib/propagators/jaeger v1.42.0 // indirect
198198
go.opentelemetry.io/contrib/propagators/ot v1.42.0 // indirect
199-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect
200-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect
201-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 // indirect
202-
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.40.0 // indirect
199+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect
200+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect
201+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 // indirect
202+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.42.0 // indirect
203203
go.opentelemetry.io/otel/metric v1.42.0 // indirect
204204
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
205205
go.uber.org/dig v1.19.0 // indirect
@@ -208,19 +208,19 @@ require (
208208
go.uber.org/multierr v1.11.0 // indirect
209209
go.uber.org/zap v1.27.1 // indirect
210210
go.yaml.in/yaml/v2 v2.4.3 // indirect
211-
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a // indirect
212-
golang.org/x/mod v0.33.0 // indirect
213-
golang.org/x/net v0.50.0 // indirect
214-
golang.org/x/sync v0.19.0 // indirect
215-
golang.org/x/telemetry v0.0.0-20260209163413-e7419c687ee4 // indirect
216-
golang.org/x/text v0.34.0 // indirect
211+
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect
212+
golang.org/x/mod v0.34.0 // indirect
213+
golang.org/x/net v0.52.0 // indirect
214+
golang.org/x/sync v0.20.0 // indirect
215+
golang.org/x/telemetry v0.0.0-20260311193753-579e4da9a98c // indirect
216+
golang.org/x/text v0.35.0 // indirect
217217
golang.org/x/time v0.12.0 // indirect
218-
golang.org/x/tools v0.42.0 // indirect
218+
golang.org/x/tools v0.43.0 // indirect
219219
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
220220
gonum.org/v1/gonum v0.17.0 // indirect
221-
google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect
222-
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
223-
google.golang.org/grpc v1.78.0 // indirect
221+
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect
222+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect
223+
google.golang.org/grpc v1.79.2 // indirect
224224
google.golang.org/protobuf v1.36.11 // indirect
225225
gopkg.in/yaml.v2 v2.4.0 // indirect
226226
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)