capsule trust: a signed kernel refuses an unsigned capsule; the intermediate is the anchor (#139)

capsule_sig_refused(), the one decision at v4's boot and v3's three
births: INVALID always; MISSING and NO_ROOT_KEY on a signed build
(CAPSULE_SIGNED_BUILD, set exactly when the Makefiles sign). A
developer build warns and boots. test_capsule_sig, built both ways,
did not build without it; 4 checks each way now. nightly.sh
capsule-trust, a nightly step: signed, v4:centre.4th left unsigned
(test only), amd64 must refuse it -- CI's, as ruled, since only CI has
the key. No root check, as ruled; the step-4 trust model (blobs signed
by their authors, MANIFEST.md hashes, contributors' intermediates,
snakeoil) recorded as given. FABRIC-3 XLIX. Gates pass, POST 992/992.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-20 22:37:25 +00:00
parent 5425d52cb1
commit 9db364f7c7
20 changed files with 1750 additions and 11 deletions
+41 -1
View File
@@ -1,6 +1,6 @@
# Capsule trust: no unsigned capsule on a signed build (#139) -- design, for ruling
Written 2026-11-20. **Nothing here is built.**
Written 2026-11-20. **Built 2026-11-20** (section "Built", below; FABRIC-3 XLIX).
## The rulings (Captain Bob, 2026-11-20, one at a time)
@@ -52,3 +52,43 @@ Written 2026-11-20. **Nothing here is built.**
capsule's signature, and expects the boot refused at that capsule. This container has no key, so that
boot is CI's, and the host test and the boots here cover the rest. Asked: that, or a throwaway CA made
here, its intermediate standing in for the real one in a test build.
## Built (2026-11-20)
As the design, with one difference in step 4: the refused-capsule boot is CI's (ruling 4).
`scripts/nightly.sh capsule-trust`, in `nightly.yml`, builds signed with `CAPSULE_TEST_UNSIGN=v4:centre.4th`
(`scripts/capsule_unsign.py` takes that one signature out after mkcapsule), and boots amd64 in the session's
`unsigned_capsule` mode. It expects the capsule's "missing (unsigned)" line, `POST: FAILED` and no prompt.
- **Checked here:** the mode refuses to run without `SIGN_KEY`. The script unsigns only the capsule named,
and refuses one that is not signed and one that is not there.
- **To see in CI:** the boot itself, in the first nightly after the merge.
`kernel/tests/test_capsule_sig.c` (and `_signed.c`) was written first and did not build without
`capsule_sig_refused`. It now passes 4 checks on each build (`logs/20261120-capsule-trust/`).
## Given for ADR step 4, when capsules carry trains (Captain Bob, 2026-11-20)
Recorded as given, to design from at step 4 ("Integrity, provenance, and reproducibility checks" and the
carrying of artifacts in capsules). Nothing of it is built.
- **The capsule is a train:** "we are evolving to capsules with the v4 runtime engine towing rolling stock
named blobs". The engine is the train's `.f18a`, and the cars are its named blobs (ABI.md, "one train
per capsule").
- **Each blob is signed by its author and hashed:** "Each blob in the capsule is signed by the author and
hashed. The MANIFEST.md inside the capsule will hold each named blobs hash."
- **The authors:** "Bonafide contributors will have their own intermediate certificate and 'casual' users
get a snakeoil cert." StarshipOS's own trains are signed with the StarshipOS Capsule Signing certificate,
as today.
- **How they are told apart:** "It can tell the intermediate cert from a snakeoil because it has an
intermediate chained to the CA." So at step 4 the kernel checks an author's intermediate against the
StarshipOS Root CA's public key, anchored in the kernel. The public certificate is in the tree
(`ci/pki/starshipos-root-ca.pem`, with its published hash); the root's private key stays on the server.
This is the chain check ruling 1 leaves out for now, for the one system certificate. It comes in with
contributors' trains.
**For step 4's design, to be asked one at a time then:**
- whether `MANIFEST.md` is itself a signed blob, so its hashes are trusted;
- what placement does with a blob whose hash differs from its manifest's;
- what each tier is allowed: StarshipOS, a contributor, a snakeoil user. `contrib_capsule_refused()`
(`capsule_birth.c`, FABRIC-2 I.5) is where tiers began.