Skip to content

/chunks (and other Bee API routes) unreachable from a bzz:// origin — iOS already allows them #178

Description

@petfold

Labels: enhancement


buildGatewayUrl in the desktop bzz: handler can only ever produce one shape
of upstream URL (src/main/swarm/bzz-protocol.js:142, and the ENS branch at
:219):

url: `${antApiUrl}/bzz/${host}${parsed.pathname}${parsed.search}`,

Everything after the reference is treated as a path inside that manifest. So a
page served from bzz:// cannot reach any other Bee API route — notably
/chunks/<ref>, but also /bytes/, /feeds/, /soc/.

iOS does allow this

freedom-browser-ios routes reserved Bee API paths straight through
(Freedom/Freedom/BzzSchemeHandler.swift:259-294):

When the path looks like a reserved Bee API route (/bzz/<ref>,
/bytes/<ref>, /chunks/<ref>, /feeds/<owner>/<topic>, /soc/<owner>/<topic>),
route directly — this is how Swarm SPAs issue relative fetch('/bzz/<ref>/')
calls. Otherwise treat the path as a subpath inside the current origin's
manifest.

…with the discrimination in isBeeGatewayPath (:296). So the same page gets
different capabilities on the two platforms, and the iOS comment suggests
relative-fetch passthrough is considered normal for Swarm SPAs.

Why it matters

/chunks/<ref> is what makes client-side verification possible: fetch a
chunk, BMT-hash it, confirm it matches the reference you asked for. Without it a
page on bzz:// can only take the handler's word for what it received. On
desktop that's tolerable — the request goes to the user's own node — but it means
verification code can't be exercised on the platform where most development
happens, and a page can't offer the same guarantees across platforms.

Concretely this is the blocker for the verified read path in
swarmlite
(js/src/verify.js, js/src/index.js:33-40), which canopy could use to verify
its network index rather than trusting it (filed on canopy separately).

The awkward part

The two platforms currently block different halves of the same feature:

desktop iOS
Range → 206 works dropped (filed separately)
/chunks reachable no yes

So neither platform supports both lazy range reads and client-side verification
today, and any page wanting both has to degrade per platform.

Options

  • Mirror iOS: add an isBeeGatewayPath-style branch. Simplest, and makes the
    platforms consistent.
  • Narrower: allow only /chunks/<64-or-128-hex> — enough for verification
    without opening the wider API surface.
  • Deliberately not: if desktop's manifest-scoping is a security decision
    rather than an omission, that's a reasonable answer — but then the iOS
    passthrough is the bug, and it'd be worth saying so in one place so the next
    person doesn't assume parity.

I don't know which of these is intended, which is why this is a question as much
as a request. Note that /chunks is GET-only and content-addressed, so widening
to it doesn't expose write or node-control surface.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions