diff options
Diffstat (limited to 'src/pipeline/steps.rs')
| -rw-r--r-- | src/pipeline/steps.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/pipeline/steps.rs b/src/pipeline/steps.rs index 98089ca..89c01f2 100644 --- a/src/pipeline/steps.rs +++ b/src/pipeline/steps.rs @@ -211,21 +211,19 @@ fn pkgver(ctx: &Ctx) -> Result<StepResult> { Ok(StepResult::Done(Some(text))) } -/// Step 5 — `makechrootpkg -c -r <chroot> -- -si<key> -f`, with the log going to -/// the file the SSE tail reads. +/// Step 5 — `makechrootpkg -c -r <chroot> -- -f`, with the log going to the +/// file the SSE tail reads. No `-si`: the build environment never holds the +/// signing key — packages are signed hub-side at ingest. fn build(ctx: &Ctx) -> Result<StepResult> { let seed = ctx.cfg.chroot_seed(&ctx.profile); - let mut argv = vec![ + let argv = vec![ ctx.cfg.makechrootpkg_bin.clone(), "-c".into(), "-r".into(), seed.display().to_string(), "--".into(), + "-f".into(), ]; - if !ctx.cfg.signing_key_id.is_empty() { - argv.push(format!("-si{}", ctx.cfg.signing_key_id)); - } - argv.push("-f".into()); // Capture the child's output into the build log regardless of outcome — // the sandbox streams it here as it arrives, and the SSE tail reads the // same file. @@ -335,14 +333,13 @@ fn collect(ctx: &Ctx) -> Result<StepResult> { Ok(StepResult::Done(Some(crate::hash::hex_str(&serde_json::to_string(&pkgs)?)))) } -/// Step 7 — signature present, dependencies satisfiable, no downgrade. +/// Step 7 — dependencies satisfiable, no downgrade. Signature checking is not +/// here: the build no longer signs (the sandbox never sees the key), so the +/// signature is made at ingest, after these checks pass. fn verify(ctx: &Ctx) -> Result<StepResult> { let collect = Collect::load(&ctx.collect_path)?; let ours = db::our_package_names(&ctx.db)?; for p in &collect.packages { - if p.signature_path.is_none() && !ctx.cfg.signing_key_id.is_empty() { - return Err(Error::fail_closed(format!("{} has no signature", p.name))); - } if crate::pkgver::is_downgrade( &db::index_version(&ctx.db, &p.name)?.unwrap_or_else(|| "0".into()), &p.version, @@ -381,10 +378,14 @@ fn ingest(ctx: &Ctx) -> Result<StepResult> { std::fs::copy(from, &dest)?; } p.path = dest.display().to_string(); - if let Some(sig) = p.signature_path.clone() { + // Hub-side signing: the build environment never holds the key, so the + // signature is made here, over the exact bytes that just entered the + // store, by the same key that signs the database. A gpg failure fails + // the build closed — an unsigned artifact never reaches the repo. + if !ctx.cfg.signing_key_id.is_empty() { let sigdest = ctx.cfg.store_path(&format!("{}-sig", p.digest)); - if !sigdest.exists() && Path::new(&sig).exists() { - std::fs::copy(&sig, &sigdest)?; + if !sigdest.exists() { + crate::pipeline::publish::sign_to(&ctx.cfg, Path::new(&p.path), &sigdest)?; } p.signature_path = Some(sigdest.display().to_string()); } |
