summaryrefslogtreecommitdiffstats
path: root/src/pipeline/steps.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-18 22:45:28 +0000
committeraur-build <aur-build@localhost>2026-11-18 22:45:28 +0000
commit99ad2034be8fc5b107205199e19da831596a6791 (patch)
tree8b49bd4f72101a21fbf5924d0ad5bb8c4b07476c /src/pipeline/steps.rs
parent632a08c8543f0db533efc7bfb6728b50a77ae3d8 (diff)
downloadaur-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 'src/pipeline/steps.rs')
-rw-r--r--src/pipeline/steps.rs29
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());
}