Repository navigation
Description
TL;DR: ?format=car responses can contain blocks whose CIDs are on the denylist.
Problem
Path resolution goes through the denylist, so a blocked root or blocked subpath returns 410 in every response format. The CAR export does not: GetCAR in boxo/gateway walks the DAG with the raw DAGService, so a directly blocked CID inside an allowed directory ends up in the CAR body.
Not a regression. The end-to-end case in TestContentBlocking was disabled in #10360 because 0.26 already shipped this way:
kubo/test/cli/content_blocking_test.go
Lines 119 to 132 in 329838a
| /* TODO: this was already broken in 0.26, but we should fix it | |
| t.Run("Gateway returns CAR without directly blocked CID", func(t *testing.T) { | |
| allowedDirWithDirectlyBlockedCID := node.IPFS("add", "--raw-leaves", "-Q", "-rw", filepath.Join(h.Dir, "directly-blocked-file.txt")).Stdout.Trimmed() | |
| resp := client.Get("/ipfs/" + allowedDirWithDirectlyBlockedCID + "?format=car") | |
| assert.Equal(t, http.StatusOK, resp.StatusCode) | |
| bs, err := carstore.NewReadOnly(strings.NewReader(resp.Body), nil) | |
| assert.NoError(t, err) | |
| has, err := bs.Has(context.Background(), cid.MustParse(blockedCID)) | |
| assert.NoError(t, err) | |
| assert.False(t, has, "Returned CAR should not include blockedCID") | |
| }) | |
| */ |
#10805 and ipfs/boxo#458 (200 plus a CAR header for paths the gateway cannot resolve) share the code path and the fix.
Status (September 2026)
Still reproduces on current master. The fix lives in boxo and nopfs; #10948 only carries the end-to-end tests.
Remaining work, in order:
- feat: add SessionExchange support and optimize blocking checks ipfs-shipyard/nopfs#50: move blocking to the blockstore and exchange so session fetches also go through the blocker (ipfs blockservice is incompatible with sessions ipfs-shipyard/nopfs#34). Needs review and a tagged release.
- fix(gateway): prevent blocked CIDs in CAR responses boxo#1019: skip blocked blocks during CAR traversal and hold headers until the first block so 404/410 can still be sent. Needs a rebase on main, a green
remote-car-backendconformance job, a changelog entry, and a release. - fix(gateway): prevent blocked CIDs in CAR responses #10948: bump boxo and nopfs, keep the CAR cases in
TestContentBlocking, add the changelog entry.
gateway-conformance already accepts 404 for unresolvable CAR paths (ipfs/gateway-conformance#244, ipfs/gateway-conformance#245), so no conformance change is needed.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields🥞 Todo
Activity
fix(gateway): prevent blocked CIDs in CAR responses
test: enable CAR blocking tests
fix(gateway): prevent blocked CIDs in CAR responses
test: enable CAR blocking tests
fix: exclude blocked content from CAR responses
fix: restore session usage in CAR streaming with proper blocking
fix: update to latest nopfs and boxo with CAR blocking fixes