~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A group's move can download bodies of any size into memory

Closed
Closed chadtmiller.com opened this issue 0 comments

What happened

every download in a move reads the whole body with bytes() / json(). The only bound is the pinned client's 10 s timeout. migrateReceive is open to anyone signed in (see above), and it fetches from whatever PDS the group's DID document names, so a server the caller controls can stream gigabytes into the host's memory within that timeout. It can do this to several requests at once. A blob is checked against BLOB_UPLOAD_LIMIT only after it is fully read (blobs.rs:60). Import is gated by founders, but it reads the same way. capped(res, ..) already exists (oauth_clients.rs:293) and these reads do not use it. No test covers it.

How to see it

Read against docs/fresh at 4636e6d, the code at: migration.rs:516 (getRepo res.bytes()), migration.rs:575, 591, 606, 612 (pull bodies); import.rs:287, 310 (copy_blob, getRepo). Paths are under crates/group-host/src unless they say otherwise. Severity: medium.

What you expected

Read every move/import download through capped. Use BLOB_UPLOAD_LIMIT for blobs, a repo/archive limit (like import_space's ARCHIVE_AT_MOST) for getRepo and STAR, and DOCUMENT_AT_MOST for the JSON parts. Refuse with SourceUnreadable / UpstreamFailure when a body is over its limit.

Where

The host, as built from 4636e6d. Found while checking the docs against the code.