Skip to content

denylist: ?format=car does not skip directly blocked CIDs #10361

Open

Description

@lidel

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:

/* 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:

  1. 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.
  2. 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-backend conformance job, a changelog entry, and a release.
  3. 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.

Activity

  1. added
    kind/bugA bug in existing code (including security flaws)
    need/triageNeeds initial labeling and prioritization
    on Mar 1, 2024
  2. moved this to 🥞 Todo in IPFS Shipyard Teamon Mar 1, 2024
  3. self-assigned this
    on Aug 30, 2025
  4. added a commit that references this issue on Aug 30, 2025
    334247a
  5. reopened this on Aug 30, 2025
  6. added 6 commits that reference this issue on Aug 30, 2025
    431116c
    dba0bc4
    fea028b
    99cef5c
    737311e
    8362b07
  7. removed their assignment
    on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bug in existing code (including security flaws)need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions