summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 12:11:32 +0000
committeraur-build <aur-build@localhost>2026-11-19 12:11:32 +0000
commit43a2bfaaac60bc378135ad90c46c9d42777aeb1e (patch)
treef0269a513275490abb250697ed1ffc6aec2ba8a2 /docs
parentfa921c26bade47634506b57b32713421f976ae22 (diff)
downloadaur-build-43a2bfaaac60bc378135ad90c46c9d42777aeb1e.tar.gz
aur-build-43a2bfaaac60bc378135ad90c46c9d42777aeb1e.zip
docs: the sandbox decisions, recorded where decisions get recorded
DECISIONS.md gains the three entries this work turned on: signing moved hub-side to ingest (the build machine must never hold the key), the devtools chroot is gone (the sandbox is the isolation boundary, and I9 gets stronger with it), and dependencies arrive pinned by digest via pacman -U rather than being resolved at build time. Each states the pressure, the choice, and the cost — including the costs: the unsigned window between build and ingest, the makechrootpkg-convention PKGBUILD tail to hunt in the gated tier, and the official-package pinning that is honestly still future work. DESIGN.md's step table and §8.3 now describe what the code does, and a new §8a documents the sandbox-backend seam: loopback, remote, kata, and the TTL as the guarantee under every leak. INVARIANTS.md's I9 note moves from 'enforced by the chroot' to 'enforced by the sandbox' — the pipeline's own hygiene test still pins what it always pinned. The README's testing section names the new shim surface and the two new test tiers, and the gated-tier list reflects the kata live tier in place of the retired real-chroot one.
Diffstat (limited to 'docs')
-rw-r--r--docs/DECISIONS.md74
-rw-r--r--docs/INVARIANTS.md20
2 files changed, 87 insertions, 7 deletions
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 68f1fee..2861fed 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -305,3 +305,77 @@ is modelled rather than crossed.
nspawn capabilities devtools expects), devtools installed, a real signing key,
`signing_key_id` set, `path_prepend` left unset so the real tools are found, then
subscribe to a real pkgbase and drive it through `aur-build serve`.
+
+## Signing moved from the build step to hub-side ingest
+
+The build step used to pass `-si<key>` through to `makepkg`, which meant
+whatever machine ran the build had to hold the signing key. That was survivable
+when the build was a chroot on the hub; it disqualifies every form of remote or
+disposable build sandbox, because a machine executing untrusted PKGBUILD code
+must never be a machine that can mint our signatures.
+
+**Choice.** The build produces unsigned bytes. `ingest` signs the exact bytes
+that entered the store, with the same key and the same code path that signs the
+database (`publish::sign_to`), 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 emits `.sig` only when `-si` is passed, like the real tool, so the suite
+cannot accidentally test a signing path the pipeline no longer has. A test
+asserts both halves: zero `-si` on any build invocation, and the signature
+ingest recorded was made over the stored artifact's bytes.
+
+**Cost.** The artifact is unsigned between build and ingest — a window that
+matters not at all here (staging is hub-local and ingest re-hashes) but must
+never be widened by moving ingest off-hub. And a rebuild of a stored artifact
+re-signs it with the *current* key, which is correct but worth knowing.
+
+## The devtools chroot is gone: the sandbox is the isolation boundary
+
+§8.3 bought isolation with `mkarchroot` + `makechrootpkg`, which costs a sudo
+requirement on the build host — and DECISIONS' own real-chroot entry records
+that stack failing inside containers anyway (`systemd-nspawn` bind-arg errors).
+Once the build runs in a disposable sandbox — a Kata VM, a throwaway container,
+the loopback harness — the chroot is scaffolding inside a boundary that already
+does the job, and I9 gets *stronger*: the untrusted build never touches the
+kernel that runs the hub.
+
+**Choice.** No `mkarchroot`, no `makechrootpkg`, no nspawn, anywhere in the
+pipeline. The build step is plain `makepkg -c -f`: no `-s` (dependencies
+arrive installed; resolving them at build time is what the pinning model
+forbids) and no `-si` (see the signing entry). The step id stays `chroot` in
+the checkpoint table — the DB does not care what the string means, and
+renaming would strand every existing checkpoint row. The devtools shims stay
+in the test tier as stand-ins for the real tools so the shim protocol itself
+remains exercised, but nothing in `src/pipeline` names them.
+
+**Cost.** The "must build in a clean chroot" folklore has a real tail: some
+PKGBUILDs assume `makechrootpkg` conventions (`$PKGDEST`, non-root builder).
+A per-build disposable VM bootstrapped from a pinned base is at least as clean
+— this is how OBS builds distro packages — but expect the tail to show up in
+the gated real-build tier, and budget for `-e` shims there.
+
+## Dependencies arrive pinned by digest via `pacman -U`, not resolved
+
+A sandbox that runs `pacman -Sy` at build time re-resolves against live mirrors
+*after* `plan()` approved a world — a path from "mirror moved since review" to
+"we built it anyway," which is exactly what the fail-closed posture forbids.
+
+**Choice.** The provisioning step (step id `chroot`) builds a **lease
+manifest**: every dependency this build needs that we publish, pinned to the
+exact version and digest of the artifact the index serves
+(`db::index_artifact`). The hub re-hashes every blob before staging it into
+the sandbox, installs with `pacman -U` — no repo DBs, no `Server=`, no mirror
+at build time — and the sandbox's own `pacman -Q` must confirm the pinned
+world landed, or the build fails closed with a dedicated `WorldMismatch`
+error class. Official packages are the base image's business: they arrive
+with the sandbox, and hub-side caching of official artifacts (which also
+solves mirror-rot and mirror etiquette) is recorded as future work, not
+pretended to.
+
+**Cost.** The lease covers only what we publish; pinning the official set
+end-to-end needs the hub's official-repo cache, which is not built. And
+`pacman -U` does no dependency resolution — an incomplete closure fails with a
+world mismatch rather than being helpfully fetched, which is correct here but
+depends on `plan()` computing the closure honestly. The shim `pacman` models
+all of this for real: `-U` refuses bytes that do not hash to the digest their
+name claims, and `-Q` reports exactly what landed.
diff --git a/docs/INVARIANTS.md b/docs/INVARIANTS.md
index c148961..80a98aa 100644
--- a/docs/INVARIANTS.md
+++ b/docs/INVARIANTS.md
@@ -21,17 +21,23 @@ with `cargo test --test <file> <name>`.
## What I9 does and does not cover
-The full statement of I9 is enforced by the chroot, and the chroot tier is gated
-behind root and network (§16a). What is *not* gated, and what
-`i9_a_build_cannot_smuggle_bytes_in_from_outside_its_own_staging_dir` pins, is
-the pipeline's own hygiene: `collect` scans the srcdir for `*.pkg.tar.zst` and
-`ingest` copies whatever those paths resolve to into the content-addressed
+The full statement of I9 is enforced by the sandbox: with a remote or kata
+backend the build code runs on a machine that holds no database, no mirrors,
+and — since signing moved to hub-side ingest — not even the signing key. The
+boundary is now a VM, which is stronger than the chroot it replaced. What is
+*not* gated, and what
+`i9_a_build_cannot_smuggle_bytes_in_from_outside_its_own_staging_dir` pins,
+is the pipeline's own hygiene: `collect` scans the srcdir for `*.pkg.tar.zst`
+and `ingest` copies whatever those paths resolve to into the content-addressed
store, from where the bytes are served from our repo and signed with our key. A
build that could make one of those paths be a symlink to the keyring or the
-database would turn a missing chroot into a signed artifact of our own secrets.
+database would turn a missing sandbox into a signed artifact of our own secrets.
The test acts that attack out — the shim plants a symlink to the database file —
and asserts the build fails closed, the store is untouched, and nothing
-publishes.
+publishes. The provisioning layer adds its own I9-adjacent assertions: staged
+blobs are re-hashed by the hub before a sandbox sees them, and a sandbox whose
+`pacman -Q` misreports its world fails the build closed
+(`failure_modes::an_incomplete_closure_fails_closed_as_a_world_mismatch`).
## Invariants that are properties of the schema, not of a code path