Files
magpie/internal/update/testdata
yetone d6a6865b1f update: a file from usemagpie.ai has its attestation from usemagpie.ai, GitHub's API after (ArcticLampyrid on X)
The site's cron keeps each release's SLSA bundles on R2 as
/files/<tag>/attestations.jsonl (728f3de40, 5e51e241c), but the updater
still asked api.github.com for every file, 60 an hour unsigned, and with
Update source set to the site alone it never checked an attestation at all.

attestation() now takes the asset. A file the feed names on the site
(Site/files/<tag>/<file>) has its release's bundles read from the same
site first; GitHub's API is asked as before when the site misses: a pruned
tag's 302 to GitHub's release (not followed; that asset doesn't exist),
any other status, a body with no bundle, or the site unreachable.

The trust model is unchanged. The site is only transport: its bundles go
through the same verifyBundle (embedded Sigstore root, release.yml of
yetone/magpie-releases, the digest from the ed25519-signed SHA256SUMS).
A site bundle that fails sends the updater to GitHub's API, where a valid
bundle holds; if that API can't be read it is a refusal, not unknown, so a
tampered mirror plus a blocked GitHub can't go through as "unattested".
Update source "site alone": the site's bundles are checked, GitHub never
asked; a miss is unknown as before. Update source "GitHub": the API alone.
docs/reference.md and the start page (en, zh, ja) say so; no
docs/subsystems page covers updates. llms-full.txt regenerated.

Run (mote):
- go test -count=1 ./internal/update/ ok; go vet darwin, GOOS=linux
  -tags nogui, GOOS=windows ok; gofmt -l clean.
- node --test site/*.test.mjs 120/120.
- New tests (attest_site_test.go, fixture = the site's real
  v0.1.3986/attestations.jsonl): the site serves it and GitHub isn't asked;
  site-alone source attested; another digest refused; misses (302, 404,
  502, html, empty, cut mid-line, site down) go to GitHub; site-alone miss
  stays unknown; a tampered site bundle refused with GitHub 403/503/404 and
  with site-alone, and passes on GitHub's valid bundle; wrong identity
  refused; GitHub source and github.com files never ask the site. No test
  reaches the network (TestMain points the site at 127.0.0.1:1).
- Broken by hand, each red: never asking the site (4 tests), taking a site
  bundle unchecked (3), following the redirect (1), a failing site bundle
  plus unreadable GitHub kept unknown (2).
- Live once (a throwaway test, not committed): usemagpie.ai's real
  v0.1.3986 bundles attested magpie-cli-android-arm64 with the API pointed
  at a dead address; pruned v0.1.3985 (302) fell back to api.github.com
  and attested.

Not tried: a full app update from the site end to end; Windows and Linux
runs of the package (the change is OS-independent).
2026-11-13 12:49:24 +08:00
..