me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Bind signed release seeds to verified source archives

diviocity committed 5 days ago · b131d3c4cc32e4bd45765dc4f403107f9370a483 View patch
Unverified signature 4 files changed +35 -9
tests/FEED.md +3 -1

@@ -183,13 +183,15 @@ For Vinix's release driver with `--ports-inputs` support, prepare one directory

183183```sh

184184python3 tools/release-inputs.py "$arch" "$repo" "$desktop_client" "$desktop_x11_client" \

185185 "$native_layer" "$auditor" "$release_inputs/$release_arch" \

186- "$fingerprint" "$vinix_commit" "$release_tag"

186+ "$fingerprint" "$vinix_commit" "$release_tag" --archive-coverage "$coverage"

187187```

188188

189189Use `amd64` or `arm64` for `release_arch`. The tool checks the native desktop and login ELF targets, rejects collisions with files from either installed client, requires the signed seed to contain the installed versions from both clients, and adds the release tag to the initramfs. It writes the initramfs, X11 overlay, build info and checksum files together. The ISO driver checks the checksums and build info against its selected release before building the kernel.

190190

191191`python3 tests/release-inputs.py` covers the output format and wrong-architecture rejection. The worker also confirmed the tag in a signed test initramfs and rejected a second client requiring a package missing from the signed seed. See `foundation/ports-release-inputs-contract-02`, receipt SHA-256 `75e7b4ae23a4f0ea27f93dfd740d37d1ed3abc4cfbea906ec957186c65a1e543`.

192192

193+The candidate uses `--archive-coverage` with the complete scan from `tools/release-archives.py`. The stage tool matches the version, archive name and digest from the signed index to a verified source archive for every seeded package. The worker staged three exact packages on each target, rejected a correctly signed older x86_64 musl archive, and rejected an AArch64 musl digest mismatch. Both failures stopped before exposing an initramfs. See `foundation/ports-seed-archive-proof-02`, receipt SHA-256 `6cbe4c5c50067e318e182c0a5b936b51cf1760cc0aaa1672a9e570d12da9afc0`.

194+

193195The AArch64 sidecar preflight used the release driver's SDK extraction list and a signed Vinix musl and GCC SDK to build the static iOS runner from Vinix commit `01665ff6`. The worker reused the cross-compiled mbed TLS archive for the final link. The runner's four ELF load segments passed the 16 KiB congruence check, and `qemu-aarch64` ran `run-ios --help`. See `foundation/ports-candidate-ios-sdk-01`, receipt SHA-256 `b5130a6c933a169dfbd3951e3f015be9bbefd6143f368c7e8813f2e3ee3f83ba`.

194196

195197The candidate release worktree built and linked both Vinix kernels with the Makefile from `6e4cb463`, using two compile jobs. The worker checked the two ELF machine types and hashed both binaries before ISO assembly. See `foundation/ports-candidate-kernels-01`, receipt SHA-256 `deef1918e5124396283aa9ac23ca1e0f8e461d2618d878b7da46b812d463e9b2`.

tests/release-inputs.py +4 -2

@@ -22,7 +22,8 @@ class ReleaseInputs(unittest.TestCase):

2222 self.args = argparse.Namespace(

2323 arch="aarch64", native=root / "native", output=root / "arm64", release="iso-fixture",

2424 commit="a" * 40, repo=root / "repo", desktop=root / "desktop",

25- graphics=root / "graphics", auditor=root / "audit", fingerprint="a" * 40)

25+ graphics=root / "graphics", auditor=root / "audit", fingerprint="a" * 40,

26+ archive_coverage=root / "coverage.tsv")

2627 for name in ("bin/vinix-desktop", "sbin/vinix-session", "sbin/vinix-authd",

2728 "sbin/vinix-system", "sbin/vinix-account"):

2829 path = self.args.native / "usr" / name

@@ -45,7 +46,8 @@ class ReleaseInputs(unittest.TestCase):

4546 else:

4647 self.assertEqual(argv[1].name, "stage-image.py")

4748 self.assertIn("--release=iso-fixture", argv)

48- self.assertEqual(argv[-2:], ["--seed-client", self.args.graphics])

49+ self.assertEqual(argv[-4:], ["--seed-client", self.args.graphics,

50+ "--archive-coverage", self.args.archive_coverage])

4951 argv[5].mkdir()

5052 (argv[5] / names[0]).write_bytes(b"initramfs")

5153

tools/release-inputs.py +8 -4

@@ -38,10 +38,13 @@ def assemble(args):

3838 stage = work / "image"

3939 subprocess.run([sys.executable, tools / "bundle-x11.py", args.arch, args.desktop,

4040 args.graphics, args.auditor, bundle], check=True)

41- subprocess.run([sys.executable, tools / "stage-image.py", args.arch, args.desktop,

42- args.repo, stage, args.auditor, args.fingerprint, "--native-layer",

43- args.native, "--initramfs", f"--release={args.release}",

44- "--seed-client", args.graphics], check=True)

41+ command = [sys.executable, tools / "stage-image.py", args.arch, args.desktop,

42+ args.repo, stage, args.auditor, args.fingerprint, "--native-layer",

43+ args.native, "--initramfs", f"--release={args.release}",

44+ "--seed-client", args.graphics]

45+ if args.archive_coverage:

46+ command.extend(["--archive-coverage", args.archive_coverage])

47+ subprocess.run(command, check=True)

4548 (stage / "initramfs.tar").rename(bundle / "initramfs.tar")

4649 info = bundle / "build-info"

4750 info.write_text(f"commit={args.commit}\nrelease={args.release}\narch={arch}\n")

@@ -61,4 +64,5 @@ if __name__ == "__main__":

6164 parser.add_argument(name, type=lambda path: Path(path).absolute())

6265 for name in ("fingerprint", "commit", "release"):

6366 parser.add_argument(name)

67+ parser.add_argument("--archive-coverage", type=Path, help="verified archive inventory for the signed seed")

6468 assemble(parser.parse_args())

tools/stage-image.py +20 -2

@@ -100,7 +100,21 @@ def install_native_layer(source, root, table, seed_roots=()):

100100 walk(source, root)

101101

102102

103-def snapshot(repo, dest, ring, arch, gpg_home):

103+def verified_archives(coverage):

104+ verified = {}

105+ seen = set()

106+ with coverage.open() as stream:

107+ for row in csv.DictReader(stream, delimiter="\t"):

108+ name = row["package"]

109+ if name in seen:

110+ raise ValueError(f"duplicate archive coverage for {name}")

111+ seen.add(name)

112+ if row["status"] == "verified":

113+ verified[name] = (row["version"], Path(row["archive"]).name, row["archive_sha256"])

114+ return verified

115+

116+

117+def snapshot(repo, dest, ring, arch, gpg_home, coverage=None):

104118 def verify(path):

105119 subprocess.run(["gpgv", "--homedir", gpg_home, "--keyring", ring, str(path) + ".sig", path],

106120 check=True, stdout=subprocess.DEVNULL)

@@ -133,6 +147,8 @@ def snapshot(repo, dest, ring, arch, gpg_home):

133147 if (name in indexed or package_arch not in (arch, "any") or

134148 filename != f"{name}-{version}-{package_arch}.pkg.tar.zst"):

135149 raise ValueError(f"invalid database record for {name}")

150+ if coverage is not None and coverage.get(name) != (version, filename, info["SHA256SUM"]):

151+ raise ValueError(f"signed seed package differs from verified release archives: {name}")

136152 archive = copy(filename)

137153 copy(filename + ".sig")

138154 with archive.open("rb") as stream:

@@ -153,6 +169,7 @@ def stage(args):

153169 raise ValueError("put image output outside its input directories")

154170 if native and not native.is_dir():

155171 raise ValueError("expected a staging directory for the native layer")

172+ coverage = verified_archives(args.archive_coverage) if args.archive_coverage else None

156173 output.mkdir()

157174 audit = subprocess.check_output([args.auditor, args.arch, client], text=True)

158175 (output / "audited-root.log").write_text(audit)

@@ -168,7 +185,7 @@ def stage(args):

168185 raise ValueError("seed repository directory is already populated")

169186 with tempfile.TemporaryDirectory() as gpg_home:

170187 indexed = snapshot(repo / args.arch, package_dir, root / "usr/share/vpac/keyrings/vinix.gpg",

171- args.arch, gpg_home)

188+ args.arch, gpg_home, coverage)

172189 records = client / "db/local"

173190 for database in [records, *(root / "db/local" for root in args.seed_client)]:

174191 descriptions = sorted(database.glob("*/desc"))

@@ -222,5 +239,6 @@ if __name__ == "__main__":

222239 parser.add_argument("--release", default="", help="release tag stored in /etc/vinix-release")

223240 parser.add_argument("--seed-client", type=Path, action="append", default=[],

224241 help="require the installed versions from another audited client in the seed")

242+ parser.add_argument("--archive-coverage", type=Path, help="match signed seed packages to verified release archives")

225243 parser.add_argument("--initramfs", action="store_true", help="write a root-owned USTAR archive for the ISO builder")

226244 stage(parser.parse_args())