From bc8f069d18c5de3dee04ae303227a255248efc1e Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 11:17:27 +0000 Subject: pipeline: replace the devtools chroot with pinned pacman -U provisioning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The chroot step existed to run mkarchroot/makechrootpkg, whose sudo requirement was the whole reason a build had to run on the hub under root-adjacent rules. The sandbox model makes the chroot redundant: the sandbox boots from a base that already carries the official packages, and step 2 now provisions it with a lease manifest instead — every dependency we publish, pinned to the exact version and digest of the artifact the index serves. The hub re-hashes every blob before staging it, installs with pacman -U (no -Sy, no live resolution, no mirror at build time), and the sandbox's own pacman -Q must confirm the pinned world landed before a build may start. A byte that hashes differently, or a world that drifted, fails closed. The build step is now plain makepkg -c -f: no -s (dependencies arrive installed; resolving at build time is what the pinning model forbids) and no -si (ingest signs). mkarchroot/makechrootpkg are gone from the pipeline and the config; their shims stay as stand-ins for the real devtools so the shim protocol itself remains exercised. The shim pacman grew a real fake installed-database: -U refuses bytes that do not hash to the digest their name claims, -Q reports what landed, so the world check is a test and not a no-op. --- tests/shims.rs | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'tests/shims.rs') diff --git a/tests/shims.rs b/tests/shims.rs index 3422500..b21efab 100644 --- a/tests/shims.rs +++ b/tests/shims.rs @@ -174,6 +174,54 @@ fn repo_add_writes_a_pacman_database() { assert!(desc.contains("%SHA256SUM%")); } +#[test] +fn pacman_u_verifies_digests_and_q_reports_the_world() { + // The provisioning step's fail-closed world check runs against this fake: + // `-U` must refuse bytes that do not hash to the digest their name claims, + // and `-Q` must report exactly what landed. + let tmp = tempfile::tempdir().unwrap(); + let log = tmp.path().join("shimlog"); + std::fs::create_dir_all(&log).unwrap(); + let build = tmp.path().join("build"); + std::fs::create_dir_all(&build).unwrap(); + std::fs::write(build.join("PKGBUILD"), common::pkgbuild("plain-make", "1.0", "1", "")).unwrap(); + shim( + "makepkg", + &build, + &[("AUR_SHIM_MANIFEST", &fixture_manifest("plain-make")), ("AUR_SHIM_DIR", &log)], + &["-c", "-f"], + ); + let pkg = build.join("plain-make-1.0-1-x86_64.pkg.tar.zst"); + let bytes = std::fs::read(&pkg).unwrap(); + let blob = tmp.path().join(aur_build::hash::hex(&bytes)); + std::fs::write(&blob, &bytes).unwrap(); + + let (code, _, err) = shim( + "pacman", + tmp.path(), + &[("AUR_SHIM_DIR", &log)], + &["-U", "--noconfirm", &blob.display().to_string()], + ); + assert_eq!(code, 0, "{err}"); + + let (code, out, _) = shim("pacman", tmp.path(), &[("AUR_SHIM_DIR", &log)], &["-Q"]); + assert_eq!(code, 0); + assert!(out.contains("plain-make 1.0-1"), "the world check reads -Q: {out}"); + + // A blob whose bytes do not match the digest its name claims is refused + // like a bad signature: name it with some other digest's hex. + let bad = tmp.path().join(aur_build::hash::hex(b"some other artifact")); + std::fs::write(&bad, b"tampered").unwrap(); + let (code, _, err) = shim( + "pacman", + tmp.path(), + &[("AUR_SHIM_DIR", &log)], + &["-U", &bad.display().to_string()], + ); + assert_ne!(code, 0, "a digest mismatch must fail closed"); + assert!(err.contains("hash"), "{err}"); +} + #[test] fn gpg_writes_a_detached_signature() { let tmp = tempfile::tempdir().unwrap(); -- cgit v1.2.3