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 /src/pipeline/publish.rs | |
| 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 'src/pipeline/publish.rs')
| -rw-r--r-- | src/pipeline/publish.rs | 16 |
1 files changed, 14 insertions, 2 deletions
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 @@ -308,10 +308,22 @@ 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(()) } |
