diff options
| author | aur-build <aur-build@localhost> | 2026-11-18 22:45:28 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-18 22:45:28 +0000 |
| commit | 99ad2034be8fc5b107205199e19da831596a6791 (patch) | |
| tree | 8b49bd4f72101a21fbf5924d0ad5bb8c4b07476c /tests | |
| parent | 632a08c8543f0db533efc7bfb6728b50a77ae3d8 (diff) | |
| download | aur-build-99ad2034be8fc5b107205199e19da831596a6791.tar.gz aur-build-99ad2034be8fc5b107205199e19da831596a6791.zip | |
pipeline: signing moves from the build step to hub-side ingest
The build step used to pass -si<key> 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.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/pipeline.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/pipeline.rs b/tests/pipeline.rs index 59a1b35..878c193 100644 --- a/tests/pipeline.rs +++ b/tests/pipeline.rs @@ -85,6 +85,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<String>) = 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"); let c = approve_fixture(&env, "plain-make"); |
