Skip to content

feat(fetch): fbuild-owned sha256 for every bucket object via a sharded manifest (#1815) - #1817

Merged
zackees merged 4 commits into
mainfrom
feat/owned-checksums-1815
Oct 31, 2026
Merged

zackees merged 4 commits into
mainfrom
feat/owned-checksums-1815

Conversation

@zackees

@zackees zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member

Closes #1815.

What

  • Checksums we compute ourselves: ci/gen_mirror_manifest.py lists the whole fbuild Spaces bucket and SHA-256-hashes every registry object from the bucket's own copy. It's incremental and checkpointed: an object already in a shard with the same size is never re-downloaded.
    • Output: site/mirror/manifest.json is now a zackees/manifest.json Index (1.7 MB) mapping each registry owner to a sha256-pinned shard Release in site/mirror/shards/. That's 8,024 shards covering 29,299 objects, and every one passes manifest-validate.
    • Bookkeeping skipped: objects that aren't registry downloads, such as _state/, are left out.
  • Client (fbuild-packages-fetch):
    • Shard fetch: the client fetches only the shard for the owner being downloaded. It verifies the shard against the index (size and sha256), caches it per owner, and falls back to the last cached shard when no source serves the current one. A shard that is itself an Index is refused, and relative shard URLs may not climb out of the manifest directory.
    • Verification: bucket bytes that don't match the shard sha256 are rejected, and the vendor URL serves the file. Objects added to the bucket after the last hash run stay bucket-first and unverified, as before.
  • Contact with PlatformIO: only the primary download, with no registry mirrors, no ?bypass= iteration and no metadata requests.
  • GitHub: the bucket mirrors only the registry layout, so the github.com/… mapping from Builds should download from the fbuild-controlled mirror bucket by default #1806 is removed.

Bugs found while testing

  • Control characters in URLs: URL validation let control characters through; a JSON \\b decoded to a backspace inside a URL. They are now rejected.
  • Spaces in registry URLs: the registry API returns some download URLs with a literal space (for example dmytro korniienko/...). Those now match their %20 manifest entry and shard key, and the primary is always kept in the attempt order.

Verification

  • Unit tests: soldr cargo test -p fbuild-packages-fetch passes 246 tests. They cover:

    • shard fetch, verification, per-owner caching and the stale fallback;
    • tampered, hostile and nested shards, and unsafe shard paths;
    • the space-URL case and the primary always being attempted;
    • a no-PlatformIO-mirror candidate test;
    • a check of all 29,299 committed entries against the index.

    Clippy is clean.

  • Sample against PlatformIO: a one-time maintainer check of 40 random objects compared our hashes with the bytes downloaded from the PlatformIO registry. All 40 matched.

  • End to end with the real CLI (fbuild install, a fresh cache, a project with lib_deps = bblanchon/[email protected], a package resolved at runtime and not named in fbuild's code):

    • Real generated site/mirror served locally: exactly 2 shards fetched (platformio, bblanchon), both packages served from the bucket and verified, nothing rejected, no bypass.
    • Adversarial local shards: a tampered mirror was rejected by the shard sha256 and the vendor served the file; a good mirror was served; a tampered shard was rejected and its mirror never contacted.
  • Still to run after merge and Pages deploy: the #[ignore] live test published_manifest_resolves_live.

Note

The hash run ran from a workstation (about 26 MB/s with 32 streams, roughly 90 minutes) instead of a droplet in sfo3. That avoided provisioning a paid machine, and the transfer should stay within the bucket's included monthly allowance.

🤖 Generated with Claude Code

…d manifest (#1815)

ci/gen_mirror_manifest.py now lists the whole mirror bucket, hashes each
object from the bucket's own copy (incremental, checkpointed), and writes
site/mirror/manifest.json as a manifest.json Index pointing at one
sha256-pinned shard Release per registry owner (8024 shards, 29299
objects). The client fetches only the shard for the owner being
downloaded, verifies it against the index, caches it, and falls back to
the last cached shard when no source serves the current one; bucket bytes
that do not match are rejected and the vendor URL serves the file.

fbuild never contacts PlatformIO except for the primary download: no
registry mirrors, no bypass iteration, no metadata requests. The bucket
mirrors only the registry layout; the github.com mapping from #1806 is
removed. URL validation now also rejects control characters, and registry
URLs with literal spaces match their %20 manifest entries.

Closes #1815
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Heads-up: this PR's two failing checks are the repo-wide Dylint setup failure fixed in #1819 (merged f4e075d) — the failures predate it. Nothing in this diff is implicated; merging origin/main into the branch (not rebasing) picks up the new dylint pin and the lane will run for real again.

@zackees
zackees added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 96f54e7 Oct 31, 2026
28 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 1, 2026
@zackees
zackees deleted the feat/owned-checksums-1815 branch November 5, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Publish fbuild-owned sha256 for every bucket object (sharded manifest); registry paths only, no GitHub mirror, no PlatformIO fallback or metadata calls

1 participant