Skip to content

K2GO-554 feat(download): app-side rootfs signature verify - #760

Merged
luisguzman-adfa merged 12 commits into
mainfrom
feat/K2GO-554-app-verify
Nov 12, 2026
Merged

luisguzman-adfa merged 12 commits into
mainfrom
feat/K2GO-554-app-verify

Conversation

@luisguzman-adfa

@luisguzman-adfa luisguzman-adfa commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

  • Final scope of this PR (the text above covers only the first commit, D5).
  • Trust: the app checks only the minisign global signature (one Ed25519 verify) and reads a manifest from the trusted comment (k2go-rootfs v1 file= size= sha256= meta4=). RootfsManifest.judge needs the existing SHA-256 pass (DownloadVerifier), a matching manifest, and the requested tier/ABI. No BLAKE2b on the device.
  • Bake: the signing step writes that manifest and fails on a stale .sha256 or .meta4.
  • Install: a trusted gzip download skips the listing pass; one extract pass with a byte bar (gzip ISIZE, lifted past 4 GiB).
  • ADR-K2GO-554 accepted, with Amendment 1; design map entry in CLAUDE.md.

Why

  • The first design (BLAKE2b over the whole tarball) took 2 min 12 s on a OnePlus 7T with a frozen bar, and about 11 to 19 min on a Q8 (no crypto extensions).

Verifications

  • Two-pass code review on the full PR and on the final delta; 1190 unit tests green; CI 4/4.
  • OnePlus 7T, dev full arm64: trust check 0.16 s; download end to extraction done 2 min 31 s (was 4 min 46 s).
  • Q8, dev standard armeabi-v7a: trust check 1.3 s; no listing; about 51 min after download (was about 1 h 39 min).
  • Bake run ADFA-4445 fix(dashboard): rebrand to K2Go Dashboard #69 (dev, all tiers and arches) signed every tarball with the manifest.

Notes

  • Deferred: zero-pass download (A6), BitTorrent (A4), trusted restore and backup folders (K2GO-569, K2GO-570), ETA smoothing (K2GO-556).

…(D5)

Add MinisignVerifier (BouncyCastle lightweight: streamed BLAKE2b-512 plus two Ed25519
checks, prehashed "ED" only) and TrustedSigningKeys (public keys pinned by key id).
isTrusted fails closed on a missing, malformed, or unknown-key signature. Bundle
bcprov-jdk15to18. Hermetic JVM tests (in-test keygen and signing) and an on-device test.
… D8)

When an official rootfs download carries a minisign signature from a pinned key,
TarExtractor skips the listing pass (the bake gate checked traversal before
signing) and drives the byte bar from the gzip feeder against the gzip ISIZE.
Aria2Manager verifies the sidecar after the integrity gate, opt-in per caller.
Fail closed to the full listing when unsigned or unverified.
Q8 (Cortex-A7, no crypto extensions): BLAKE2b 3.4 MiB/s vs SHA-256 34 MiB/s. Identity comes from the minisign trusted comment, integrity from the existing SHA-256 pass.
…d comment

file, size, sha256 and meta4 hash, authenticated by the global signature. A stale .sha256 or .meta4 now fails the bake.
…y BLAKE2b

One Ed25519 check plus the existing DownloadVerifier pass replaces the full-file BLAKE2b (2 min 12 s on a OnePlus 7T, about 19 min projected on the Q8).
…heck

BitTorrent stays on until the zero-pass step (A6). Trust also requires the signed file name to name the requested tier and ABI.
An unsigned meta4 could offer an official tarball of another ABI or tier; the signed file name must now match the request. RootfsTier.id() is the one tier token for the URLs and this check.
…d bar

Full tiers are above 4 GiB, so the ISIZE trailer wrapped and the bar sat at 99%. Trust now applies only to gzip without validateRootfs, and the .minisig read is capped.
…esign map

OnePlus 7T: trust check 0.16 s (was 2 min 12 s). Q8: no listing; cold SHA-256 at 11.9 MiB/s is now the main verify cost.
All decisions, including Amendment 1, are implemented and verified on device.
The trusted bar gets the bundled rootfs_sizes.csv snapshot, not the live .installed sidecar.
@luisguzman-adfa
luisguzman-adfa merged commit 6533abc into main Nov 12, 2026
4 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the feat/K2GO-554-app-verify branch November 12, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant