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
+36
View File
@@ -6847,3 +6847,39 @@ What the record asks beyond POST, each gap put to Captain Bob one at a time:
tag"): PR #197 merges once its Acceptance passes, and a tag on `master` marks the line. New work starts
after it.
## XLIX. Capsule trust: the intermediate is the anchor, and a signed kernel refuses an unsigned capsule (#139, 2026-11-20)
### 1. Found
XLVI left two things open (2026-11-07). The kernel does not check the image's signing certificate against
the StarshipOS Root CA. And an unsigned capsule (`CAPSULE_SIG_MISSING`) is only a warning, as ruled on
2026-08-26, when CI had no key. Since XLVI, CI signs every build, and the gate into master and a release
refuse an unsigned one (#174).
### 2. Ruled (Captain Bob, 2026-11-20; `docs/v4.0.0/plans/2026-11-20-capsule-trust.md`)
1. **"Intermediate is the anchor; no root check."** The "StarshipOS Capsule Signing" certificate in the
image (XLVI) is what capsules are trusted by. No root key goes in the kernel or in CI. First ruled
"verify at boot"; withdrawn when asked where CI would take the root's certificate from: "Actually we
decided to include an intermediate certificate in the kernel". On the way it was found that the root's
private key is on the CI server beside its certificate, in `/var/lib/starshipos-ca/root/` (mode 700),
so mounting that directory into CI jobs, one way to reach the certificate, would have exposed it.
2. **"Refuse on signed builds."** A kernel built with the signing key refuses an unsigned capsule. A
developer build, without the key, warns and boots.
3. **"NO_ROOT_KEY, by build."** A signing certificate missing from the image, or one that cannot be read,
is refused on a signed build and warned of on a developer build.
4. **"Left to CI."** The boot of a signed kernel with an unsigned capsule is CI's to show, since only CI
has the key.
### 3. Built
- `capsule_sig_refused()` (`kernel/src/capsule/capsule_sig.c`): the one decision. INVALID always;
MISSING and NO_ROOT_KEY on a signed build (`CAPSULE_SIGNED_BUILD`, set by `kernel/Makefile` and
`v4/Makefile` exactly when they sign). v4's boot and v3's three births ask it.
- `kernel/tests/test_capsule_sig.c`, built twice, unsigned and signed: written first, it did not build
without the function. It now passes 4 checks each way.
- `scripts/nightly.sh capsule-trust`, a step of `nightly.yml`: a signed build with `v4:centre.4th` left
unsigned (`CAPSULE_TEST_UNSIGN`, `scripts/capsule_unsign.py`, for the test only), booted on amd64. It
must say `missing (unsigned)` and stop with `POST: FAILED`, and give no prompt. It is not a protocol
stage, since a developer has no key. It is first seen in the nightly after this merges.