diff options
Diffstat (limited to 'tests/pipeline.rs')
| -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"); |
