From 99ad2034be8fc5b107205199e19da831596a6791 Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 22:45:28 +0000 Subject: pipeline: signing moves from the build step to hub-side ingest The build step used to pass -si through makechrootpkg, which meant whatever machine ran the build had to hold the signing key - fine for a chroot on the hub, disqualifying for a remote sandbox. The build now produces unsigned bytes; ingest signs the exact bytes that entered the store, with the same key and code path that signs the database, and a gpg failure fails the build closed. verify() no longer checks for a build-made signature: the meaningful guarantee moved to 'ingest produced one or the build failed'. The shim makechrootpkg now only emits .sig when -si is passed, like the real tool, so the suite cannot accidentally test a signing path that no longer exists. --- tests/pipeline.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests/pipeline.rs') diff --git a/tests/pipeline.rs b/tests/pipeline.rs index 59a1b35..878c193 100644 --- a/tests/pipeline.rs +++ b/tests/pipeline.rs @@ -84,6 +84,39 @@ fn end_to_end_publishes_a_signed_index() { ); } +#[test] +fn the_build_never_signs_ingest_does() { + // Signing moved hub-side: the build environment is a sandbox that must + // never hold the key, so the build command carries no `-si` and the + // signature over each artifact is made at ingest by the hub's own gpg. + // This is the property that makes a remote build sandbox safe to run at + // all — worst the sandbox ever returns is unsigned bytes. + let (env, _fx) = env_with_fixture("plain-make"); + let c = approve_fixture(&env, "plain-make"); + assert!(matches!(run_for(&env, &c), pipeline::Outcome::Succeeded { .. })); + + let shimlog = env.cfg.hooks.shim_dir.clone().unwrap(); + assert_eq!( + aur_build::shims::called_with(&shimlog, "makechrootpkg", "-si"), + 0, + "the build step must not hand a signing key to the sandbox" + ); + + let (digest, sig_path): (String, Option) = env + .db + .read(|c| { + Ok(c.prepare("SELECT digest, signature_path FROM artifact LIMIT 1")? + .query_row([], |r| Ok((r.get(0)?, r.get(1)?)))?) + }) + .unwrap(); + assert!(sig_path.is_some(), "ingest must record a signature for the artifact"); + assert!(std::path::Path::new(sig_path.as_ref().unwrap()).exists()); + assert!( + aur_build::shims::called_with(&shimlog, "gpg", &digest) > 0, + "the signature ingest recorded was made over the stored artifact's bytes" + ); +} + #[test] fn i1_no_index_entry_without_an_approval() { let (env, _fx) = env_with_fixture("plain-make"); -- cgit v1.2.3