Reject incomplete downloads instead of reporting success (PLAT-718) #298
Loading…
Reference in a new issue
No description provided.
Delete branch "stephen/plat-718-download-check"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fj run download,fj workflow artifactandfj release downloadcould report success on a truncated file. PLAT-718: Actions artifact zips fetched through the fjord.sh forge gateway were cut short at about 88 to 92 MB, and fj wrote and announced them as complete.Downloads now go through one
download::verified_bodypath:.zipmust end in a readable end-of-central-directory record whose directory sits inside the file, including ZIP64 archives (followed through the ZIP64 locator).The gateway half is fjord-platform#1313 (the gateway now errors the response when the upstream body fails, instead of ending it cleanly).
Tests:
cargo test --bin fj(1336 pass), including wiremock cases for a short body, a missing Content-Length with a known release size, transport retries, and unit cases for ZIP64, the read cap and file modes.Automated Codex review (read-only) of head
2529711a94.src/download.rs:120(edge case). Invariant: malformed downloads must return an error without crashing. The ZIP64 locator supplies an unchecked offset used inat + 56. A crafted offset nearusize::MAXoverflows, causing an arithmetic panic in debug builds or a subsequent slice panic in release builds. This affects both artifact download routes and.ziprelease assets through the shared validator. Usechecked_add(56)andbytes.get(at..end)before reading the record, and add a malformed-locator regression test.BLOCKING: 0
Reviewed head
2529711a94at 2026-10-27T07:06:43Z by codex exec (read-only sandbox).Automated Codex review (read-only) of head
8ebb39975a.src/download.rs:120. Invariant: malformed downloads must return validation errors, never crash the process. The ZIP64 locator supplies an untrusted offset, butat + 56uses unchecked arithmetic. On 64-bit systems, an offset such asu64::MAX - 55overflows: debug builds panic immediately; release builds wrap, pass the bounds check, then panic while slicing. A malformed ZIP can therefore abortfj run download,fj workflow artifact, orfj release downloadinstead of following the new validation and retry path. This is introduced by the ZIP64 parser. Usechecked_add(56)andbytes.get(at..end); add a regression case with an overflowing locator offset.BLOCKING: 0
Reviewed head
8ebb39975aat 2026-10-27T13:30:48Z by codex exec (read-only sandbox).Automated Codex review (read-only) of head
c8445cac68.src/download.rs:120. Invariant: malformed download bytes must return a validation error rather than panic (standards 4 and 8). The ZIP64 locator supplies an unchecked offset used inat + 56. On 64-bit builds, a locator offset nearu64::MAXoverflows; with release overflow checks disabled, the subsequent slice still panics. A malformed ZIP downloaded through either artifact route or the release ZIP path therefore terminates the CLI instead of returning the promised download error. Use checked addition and bounded slice access, and add a malformed ZIP64 locator regression test.BLOCKING: 0
Reviewed head
c8445cac68at 2026-10-27T15:06:49Z by codex exec (read-only sandbox).