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. --- src/pipeline/publish.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/pipeline/publish.rs') diff --git a/src/pipeline/publish.rs b/src/pipeline/publish.rs index 94fc46f..fd2fdd1 100644 --- a/src/pipeline/publish.rs +++ b/src/pipeline/publish.rs @@ -305,13 +305,25 @@ fn run_repo_add(cfg: &Config, db_path: &Path, pkgs: &[PathBuf]) -> Result<()> { } fn sign(cfg: &Config, path: &Path) -> Result<()> { + if cfg.signing_key_id.is_empty() { + return Ok(()); + } + let sig = format!("{}.sig", path.display()); + sign_to(cfg, path, Path::new(&sig)) +} + +/// `gpg --detach-sign` over `path`, written to `sig_out` atomically. Shared by +/// publish (the database) and ingest (the packages): one key, one code path, +/// and the key never leaves the hub — a build sandbox signs nothing (§8, +/// remote-builder design). +pub(crate) fn sign_to(cfg: &Config, path: &Path, sig_out: &Path) -> Result<()> { if cfg.signing_key_id.is_empty() { return Ok(()); } let mut cmd = Command::new(&cfg.gpg_bin); cmd.args(["--batch", "--yes", "--detach-sign", "--local-user", &cfg.signing_key_id]); cmd.arg("-o"); - let tmp = format!("{}.tmp", path.display()); + let tmp = format!("{}.tmp", sig_out.display()); cmd.arg(&tmp); cmd.arg(path); cfg.child_env(&mut cmd); @@ -322,7 +334,7 @@ fn sign(cfg: &Config, path: &Path) -> Result<()> { detail: String::from_utf8_lossy(&out.stderr).into_owned(), }); } - std::fs::rename(&tmp, format!("{}.sig", path.display()))?; + std::fs::rename(&tmp, sig_out)?; Ok(()) } -- cgit v1.2.3