mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
A first build of base gave back each package it downloaded with apt's
entry for it, and the host took the build VM's word that each entry was
apt's: anything with root in that VM before apt.sh end could record a
package with a made-up entry, which every later build of the key
replayed. Now the build also hands back the InRelease files and package
lists apt used, and the host checks them itself before it keeps
anything:
- each InRelease is clearsigned by Ubuntu's archive key, pinned in
assets/layers/ubuntu-archive.gpg ("Ubuntu Archive Automatic Signing
Key (2018)", F6ECB3762474EDA9D21B7022871920D1991BC93C, from
keyserver.ubuntu.com by fingerprint, checked against the Ubuntu
security team's list), and one of 26.04's suites;
- each package list has the SHA-256 and size a verified InRelease gives
one of its Packages lists;
- each recorded .deb's SHA-256 is in one of those lists, as the package,
version, architecture and size apt's entry says, and the set keeps
the archive's own entry.
- internal/ubuntu/pgp.go verifies clearsigned messages (RFC 4880's
cleartext signatures: text signatures, dash-escaping, trailing
whitespace, nothing before or after); archive.go's VerifyRelease and
Release.Lists read a verified InRelease (ArchiveKeyring).
- assets/layers/apt.sh: record copies apt's *_InRelease and *_Packages
lists to out/<n>.InRelease and out/<n>.Packages; base's build keeps
lists uncompressed (Acquire::GzipIndexes "false").
- internal/build: take accepts the lists (an InRelease at most 4 MiB and
all of them 32 MiB, a list 512 MiB with lines of 1 MiB and entries of
4 MiB, all lists 2 GiB, no name twice), signedEntries and
archiveEntry check them; cache carries devvm's own files for the key.
- Tests: Ubuntu's real resolute-updates InRelease verified, and refused
when changed, framed differently or signed by another key; clearsigned
parsing (dashes, CR LF, trailing whitespace, a binary signature
refused); InRelease fields; a recording refused for a forged
InRelease, a list no InRelease gives, a .deb no signed list has,
another package's entry, missing lists, a list or an InRelease twice,
a line over 1 MiB; a good set kept
with the archive's entry (gpg-made fixtures in
internal/build/testdata/archive); apt.sh's record giving back the
lists.
- Docs: images.md's Base's packages, design.md's trust note (the
recording VM's made-up packages closed), settings.md's mirror
section, maintaining.md's archive key.
Co-Authored-By: Claude Opus 5.5 <[email protected]>