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

Moving a group here takes only founders and no more than the host keeps

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:host/moving-limits

What changes

Founders only. migrateReceive checked only that its caller held group.configure by the arriving group's own records, after pulling it all, so anyone who controls a did:plc and a server could bring a group onto a host whose GROUP_FOUNDERS leaves them out. It now refuses NotAllowed first, as createGroup and importAccount do; the three share one check (Host::founding). Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdcmv7bwwl.

Downloads have a limit. Every read of another server's answer in a group's move, an account's import and the console's account move used to read the whole body into memory. Each now goes through capped: a file to BLOB_UPLOAD_LIMIT, a repo or a repo in a space to 256 MiB (REPO_AT_MOST), any other answer to 16 MiB (ANSWER_AT_MOST). More stops a group's move; an import leaves out a file over its limit, as it does any file that does not come. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdcobiunyu.

A nonce is asked for once. A move's call to an account's server retried for as long as the server answered use_dpop_nonce without a DPoP-Nonce header. It now asks once, as it renews a token once, and then takes the server's answer. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdd5cqbxq2.

docs/reference/config.md and docs/design/moving.md say so.

How it was checked

New tests, each failing before the change: takes_in_only_what_it_may_and_no_more_than_it_keeps (migration: a non-founder refused NotAllowed, where before the move was pulled and then refused Forbidden; a file over BLOB_UPLOAD_LIMIT stops the move), and asks_once_for_a_nonce_its_server_never_gives (account_move: answered within 20 seconds, where before it never was). The migration, account_move, import and groups tests pass; clippy is clean. The coverage gate is left to CI.

🤖 Generated with Claude Code

Approved

This pull does three things.

  • migrateReceive now refuses a non-founder with NotAllowed before it pulls anything, through a shared Host::founding that createGroup and importAccount also use.
  • Every read of another server's answer in a group move, an account import and an account move now goes through capped, with limits of BLOB_UPLOAD_LIMIT, 256 MiB for a repo and 16 MiB for other answers.
  • The DPoP nonce is asked for once, tracked by a separate nonced flag.

I read the diff against capped and copy_blob, and found no bugs. The founder check runs right after sign-in, and copy_blob returns false for an over-limit file, as the pull says. The docs match the change, and the two new tests cover the founder refusal, the over-limit file and the nonce loop. I did not see the check results, and the pull says coverage is left to CI.

One small thing, not a blocker. capped buffers each chunk before it compares against the limit, so the overshoot is bounded by one chunk. That is fine here.

Merged as 7a75bd3