From 9c90998f76a0e0fb4f268ca2d2aef43027a3c421 Mon Sep 17 00:00:00 2001 From: Lucas Winther Date: Wed, 11 Nov 2026 20:46:18 +0100 Subject: [PATCH] protondrive: correct the memory a full read may hold and note what remains unbounded The comment and spec put the block metadata a full read holds at a few hundred bytes a block; with realistic tokens and URLs the cap allows about 250-350 MiB, and those fields and API response bodies aren't bounded at all. TODO also asks the live check to confirm the root-of-trust rule on a drive made by Proton's own apps. Co-Authored-By: Claude Opus 5.5 --- backend/protondrive/download.go | 5 +++-- docs/TODO.md | 11 +++++++++++ docs/plans/001-protondrive-tier1.md | 2 ++ docs/specs/001-protondrive-tier1.md | 5 +++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/backend/protondrive/download.go b/backend/protondrive/download.go index 4eb87fbbc..eac912c4e 100644 --- a/backend/protondrive/download.go +++ b/backend/protondrive/download.go @@ -65,8 +65,9 @@ const ( // maxFileBlocks is the most blocks a file may list: 2 TiB in // 4 MiB blocks, beyond any one file the largest Proton plan, of a // few TB in all, could hold. A full read holds the metadata of - // every block, a few hundred bytes each, until the manifest is - // checked, so this bounds that whatever the server claims. + // every block until the manifest is checked, so this bounds how + // many whatever the server claims: about 250-350 MiB at the cap + // with realistic tokens and URLs. Their length isn't bounded. maxFileBlocks = 1 << 19 // contentKeyFallbackUntil is the Unix time until which a content diff --git a/docs/TODO.md b/docs/TODO.md index cbf7cedb4..c914d34e7 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -8,6 +8,17 @@ Small, specific, independently actionable. Remove only when actually done. ## Next +- [ ] protondrive: API responses have no body-size limit, and a block + list's `Token` and `BareURL` and the first page's `Thumbnails` are + unbounded, so the 2^19-block cap bounds how many blocks a full read + holds but not the bytes (about 250-350 MiB at the cap with realistic + values, unbounded against a hostile server). Consider a limit on API + response bodies and on those fields. +- [ ] protondrive: in live verification (plan Task 21), confirm on an + account whose drive was made by Proton's own apps that the + root-of-trust rule passes (the My Files share created, and its root + signed, by one of the account's addresses), and count how many folders + fail key verification. - [ ] protondrive: a range from offset 0 of a file whose size isn't recorded (`bytes=0-N`, N at or past the end) is read as a ranged read, so its manifest isn't checked; only a known size identifies a range diff --git a/docs/plans/001-protondrive-tier1.md b/docs/plans/001-protondrive-tier1.md index 31734d8e6..83c697022 100644 --- a/docs/plans/001-protondrive-tier1.md +++ b/docs/plans/001-protondrive-tier1.md @@ -599,6 +599,8 @@ library what must stay readable. (Task 16 fix round 3), and `func (u *User) SetParent(id, parentID string)` (a parent the server reports, cycles included). + `func (u *User) ClaimSize(id string, size int64)` (an uploader's + wrong size in the extended attributes). - `func (u *User) Dump() []DumpedNode` - decrypted tree for assertions (`ID`, `Path`, `IsFolder`, `Content`, `ModTime`, `SHA1`, `State`, and `Err` joining every decryption, signature, block-hash, manifest and diff --git a/docs/specs/001-protondrive-tier1.md b/docs/specs/001-protondrive-tier1.md index 78ad6338f..679d999b3 100644 --- a/docs/specs/001-protondrive-tier1.md +++ b/docs/specs/001-protondrive-tier1.md @@ -306,8 +306,9 @@ AES-GCM blocks; names, passphrases, hash keys and attributes without AEAD). verify the manifest; this is documented, as it is in the SDK. - A file may list at most 2^19 blocks (2 TiB in 4 MiB blocks, more than any one file a Proton plan can hold), whatever its unsigned size fields - claim, which bounds the block metadata a full read holds before the - manifest check (a few hundred bytes per block). + claim, which bounds how many blocks' metadata a full read holds before + the manifest check (about 250-350 MiB at the cap with realistic tokens + and URLs; their length, and API response bodies, aren't bounded yet). - A server serving an earlier revision whole (blocks, manifest and extended attributes, all validly signed) under the current revision ID is undetectable: nothing signed binds them to the revision. The SDK cannot