Repository navigation
feat(bep): issue and publish the host root certificate and hand it to each grant box - #2493
Conversation
The keychain key and the in-memory test key implement CaKey, so the root CA key issues the self-signed, name-constrained root (issue_root), and Ca::with_root keeps that root as the CA's anchor (#2440, BEP-013).
…ssues The identity carries root_certificate, the PEM of the root issued from the held root key (BEP-072). bep serve anchors its CA on that root, so an admitted CONNECT gets a leaf in place of a 502.
The mint puts the published root_certificate on a grant box's create request, and refuses a grant box whose proxy publishes none, naming bep. min box spec shows the certificate's SHA-256 fingerprint (#2446).
…publish-the-un-enrolled-host-root-cert
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none seen. |
…publish-the-un-enrolled-host-root-cert
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The root certificate and the identity file give two different expiry times. issue_root dates each root from the start time. The published root_not_after, which a mint uses as member exp, counts from the root key's creation. Gatehouse §6.10 lines 821 and 839 make the anchor's remaining validity the box's ceiling, so these two values must be one value. Make the change in C1. Also, bep serve now signs leaves but never renews its signing CA. Do C2: wire Ca::renew_signing, or record the gap as an interim with a filed issue. The rest of the change conforms.
Ruled at 0f34505 against gominimal/arch@109541a48c31 by claude-opus-5-5.
Each start issued the root with an end of now plus ten years, so after a restart the root and the signing CA outlived the published root_not_after. The start now caps the certificate at root_not_after, a re-issued root keeps the same end, and a root past its end refuses with bep --replace-key root.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to Gatehouse §6.10. The root is self-signed under the keychain-held root key and carries the registered names as constraints. Each issue keeps the same key and subject (line 839). The compare fixes the earlier gap: the certificate now ends at the root key's published end, the ceiling that line 821 gives each box. A grant box with no published root is refused before it registers. The store-rule names join the root's constraints under #2280, which is a filed residual.
Ruled at aff93f3 against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
A started proxy publishes a self-signed, name-constrained root certificate issued from its held root key. The certificate now ends at the published root_not_after on every start, so a restart does not extend it. A grant box's create request carries the certificate, and Notes from the agent: Revise round 1. The four bep test lines passed in one run filtered on |
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter review of T43 against its plan block, at aff93f33 (round 1).
Layer issue. crates/bep/src/keys.rs implements CaKey for the keychain key through SecKey::create_signature and for the in-memory test key. crates/bep/src/ca.rs issues the self-signed, name-constrained root from the held root key (issue_root, issue_root_until), anchors the CA on it (Ca::with_root), and keeps the same key and subject across issues. Round 1 ends the certificate at the root key's published validity end, and reissue_root keeps that end. Tests root_certificate_is_issued_from_the_held_root_key, keychain_root_key_signs_the_root_certificate and the new root_certificate_ends_at_the_root_key_validity_end are present. The keychain CaKey compiles on macOS alone; the macOS lane is its compile proof.
Layer publish. Identity.root_certificate carries the PEM. A start and bep --replace-key root issue and publish it; a replacement of another role keeps it. bep serve anchors its CA on the published root, so it now signs leaves where it answered 502. Tests published_identity_carries_the_root_certificate and root_replacement_publishes_a_new_root_certificate are present.
Layer hand. create.rs puts the identity's certificate on a grant box's create request and refuses a grant box whose identity publishes none, before the box registers at the proxy, with a message naming bep. box_spec.rs prints root CA certificate SHA256:<fingerprint> (#2446). The spec test lives in the box_spec.rs test module, because cmd::box_spec is private to cmd; its name matches the plan's test line. tests.rs carries grant_box_create_request_carries_the_published_root_certificate.
Consumes and produces. As the plan says. BoxConfig.root_certificate is the T42 field.
Diagnostics and observability. The spec label and one info line at start with the fingerprint and the permitted-name count. No key is logged.
Open. The review's security finding on grant_root_certificate (the certificate is decoded, not checked against the published root key) stays open until it is fixed or ruled. The arch C2 thread on signing-CA renewal is handled on its thread.
No blocking findings of my own.
Generated by Claude Code
|
/revise Act on the review's security finding at Generated by Claude Code |
…publish-the-un-enrolled-host-root-cert
A grant box trusts the published root certificate for its egress. Before the PEM goes on the create request, check that the certificate's subject public key is the identity's published root key, and refuse with the message that names `bep` when it is not. The name constraints and the signature stay the proxy's to issue and the box's TLS stack to check.
…publish-the-un-enrolled-host-root-cert
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The compare from aff93f33 adds one step. min refuses a grant box when the root certificate's subject key is not the published root key. This step fails closed. It keeps a re-certified root under the same key valid (Gatehouse §6.10 line 821). It refuses a stale root after a key replacement, as line 839 requires. The merges of main bring in no PR content. The rest of the change keeps its PASS from aff93f33.
Ruled at d86ef04 against gominimal/arch@109541a48c31 by claude-opus-5-5.
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter review of T43 at d86ef040 (round 2).
The round adds one check in crates/minimal/src/cmd/boxes/create.rs: grant_root_certificate now walks the certificate's DER to its SubjectPublicKeyInfo and refuses the grant box unless the subject key is the published root key, with the same bep-naming message. The walk reads the X.509 structure in order (version, serial, signature, issuer, validity, subject, then the key), accepts the P-256 algorithm identifier alone, and fails closed on any shape it does not expect. The test builds a certificate in that shape under the published key and under a foreign key, and pins both outcomes. The arch review ruled PASS at this head. The merges of main bring in the russh bump and the spec-lint workflow change, no PR content.
The round does not touch the two source-inventory tests that CI's Linux native tests job fails on this branch (cli_create_requests_use_the_constructor, every_create_session_asserts_the_daemon_build, both from the create_request() helper in tests.rs). That is the next round; the fix is in the task's layers.
The review's new security finding asks for a self-signature, basic-constraint and name-constraint check. Answered on its thread: only a writer of the proxy's own 0600 identity file can plant such a certificate, and that writer can replace the published key with it; the stale-root path after a key replacement is the one the key check closes. The call on building more goes to the epic owner.
No blocking findings of my own.
Generated by Claude Code
|
Round 2 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
A started proxy publishes a self-signed, name-constrained root certificate issued from its held root key. A grant box's create request carries that certificate only when its subject public key is the published root key. Notes from the agent: This round acts on the /revise note. grant_root_certificate now walks the certificate DER as far as the SubjectPublicKeyInfo. It checks that the key algorithm is P-256 and that the key is the uncompressed SEC1 point of identity.key(Role::Root). A mismatch, or an identity with no usable root key, gives the same refusal that names |
|
/revise CI's Linux native Generated by Claude Code |
…publish-the-un-enrolled-host-root-cert
…ies ask Import CreateSessionRequest so the constructor scan sees a return type, and set must_match_version like create_box_on, listing the fixture in the create-site inventory.
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter review of T43 at 8289c593 (round 3).
The round changes crates/minimal/src/tests.rs alone: the create_request() fixture imports CreateSessionRequest, writes its return type without the path prefix, and sets the version assertion, and the create-site inventory gains tests.rs::create_request = asserts with a comment naming it a fixture. That is the fix both failing inventory tests ask for. The rest of the compare is main merged in (the rcache writer change), no PR content.
Code and spec surfaces are as reviewed at d86ef040. The arch review's PASS there covers them; CI at this head decides the inventory tests.
No blocking findings of my own.
Generated by Claude Code
|
Round 3 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
A started proxy publishes a self-signed, name-constrained root certificate that it issues from its held root key. A grant box's create request carries that certificate, and Notes from the agent: Revise round 3. The create_request() test fixture now imports CreateSessionRequest and returns |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change still conforms to Gatehouse §6.10. The new commits merge main and make the mint-test fixture assert the daemon build. They do not touch the root certificate code, the publish code or the create path. BEP-013 and BEP-072 keep the status from the ruling on d86ef040. No conditions.
Ruled at 8289c59 against gominimal/arch@109541a48c31 by claude-opus-5-5.
norrietaylor
left a comment
There was a problem hiding this comment.
Approved by the babysitter at 8289c593 after the merge gate passed: own reviews at every head, arch-review PASS at 8289c593 with no conditions, the code reviewer concluded, every review thread resolved (the constraint-check finding under the epic owner's ruling of 2026-10-22), every CI lane green including macOS, and the squash subject lint-clean. Residuals filed: signing-CA renewal on T36 #2283 and the store-rule names on T25 #2280. Enqueued for a squash merge.
Generated by Claude Code
|
The merge queue removed this PR at 22:55Z: the merge group's Generated by Claude Code |
T43 — Issue and publish the un-enrolled host root certificate and hand it to each grant box
slice: S0
kind: task
covers: BEP-072, BEP-013
size: L
est: 240 code, 360 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics:
min box spec <box>shows the root certificate's SHA-256 fingerprint under the labelroot CA certificatein place of the key thumbprint, pinned by box_spec_shows_the_root_certificate_fingerprint; abepstart whose held root key cannot sign refuses with a message namingbep --replace-key rootobservability: one info log line at
bepstart naming the root certificate's fingerprint and the count of its permitted names, never a keylayers:
- issue:
- crates/bep/src/keys.rs:
CaKeyfor the keychain-held key throughSecKey::create_signature(ECDSA P-256, SHA-256), so the root and signing CA keys issue in production (#2440)- crates/bep/src/ca.rs: the root certificate is issued from the held root key at
bepstart with the permitted names of the configured modules less the deny set, and re-issued under the same key and subject when the union changes; the store rules join the union when T25 wires themtest: cargo nextest run -p bep root_certificate_is_issued_from_the_held_root_key
test: cargo nextest run -p bep keychain_root_key_signs_the_root_certificate
- publish:
- crates/bep/src/publish.rs:
Identitycarriesroot_certificate, the PEM of the current root certificate, beside the root key (BEP-072); a start or a root replacement publishes the certificate it issued- crates/bep/src/main.rs:
bepstart andbep --replace-key rootissue and publish the root certificate;bep servekeeps the issued root as the CA's anchortest: cargo nextest run -p bep published_identity_carries_the_root_certificate
test: cargo nextest run -p bep root_replacement_publishes_a_new_root_certificate
- hand:
- crates/minimal/src/cmd/boxes/create.rs: the
MintGrantsstep puts the identity'sroot_certificateon the create request for a grant box, and refuses a grant box whose identity publishes none with a message namingbep- crates/minimal/src/cmd/box_spec.rs: shows the root certificate's fingerprint (#2446)
- crates/minimal/src/tests.rs: the create-request and spec tests
test: cargo nextest run -p minimal grant_box_create_request_carries_the_published_root_certificate
test: cargo nextest run -p minimal box_spec_shows_the_root_certificate_fingerprint
produces: none
consumes:
- crates/bep/src/ca.rs
- crates/bep/src/keys.rs
- crates/bep/src/publish.rs
- crates/minimald-rpc/src/lib.rs
proof: A started proxy publishes a self-signed, name-constrained root certificate issued from its held root key, a grant box's create request carries it, and
min box specshows its fingerprint.depends on:
- blocked by T2
- blocked by T3
- blocked by T42
Generated by Claude Code
Proof
A
bepstart issues a self-signed root certificate from the held root key. Its permitted names are the GitHub module's hosts, less the deny set. The start writes the certificate asroot_certificate(PEM) in ~/.minimal/bep/identity.json and logs its fingerprint and name count.bep --replace-key rootpublishes a new certificate under the new key.bep serveanchors its CA on that root, so leaves chain to the published certificate. The create request of a box with a GitHub grant carries that PEM inroot_certificate.min box specprintsroot CA certificate SHA256:<fingerprint>.Notes from the agent: The Keychain code is macOS-only and was not compiled or run on this Linux box. That code is
CaKey for KeychainKeythroughSecKey::create_signaturewith ECDSASignatureMessageX962SHA256, the same call the existing probe makes. keychain_root_key_signs_the_root_certificate uses the in-memory store that models the keychain, which now also implementsCaKey. The macOS lane owes the real Keychain evidence. Placement: the box_spec test is in the test module of crates/minimal/src/cmd/box_spec.rs, not in tests.rs.cmd::box_specis a private module ofcmd, so tests.rs cannot reachrenderorroot_fingerprintwithout a change to cmd/mod.rs, which is outside the layers. Behavior changes: (1)bep servenow uses the real CA (Ca::with_rootover the issued root) in place of theNoSigningKeyissuer that refused every leaf with 502.NoSigningKeymoved into main.rs tests, and the #2440 clause left the serve warning. The CA keys are leaked to 'static for the life of the process. Nothing renews the signing CA in a long-running serve. Its validity is 365 days. (2) Each start issues a fresh root from the current union, so a restart after a union change gives a root under the same key and subject. The store rules join the union when T25 lands (registered_unionin main.rs). (3) If the root key replacement cannot issue a certificate, `bep --replace-key r…[truncated]Tests
cargo nextest run -p bep root_certificate_is_issued_from_the_held_root_keycargo nextest run -p bep keychain_root_key_signs_the_root_certificatecargo nextest run -p bep published_identity_carries_the_root_certificatecargo nextest run -p bep root_replacement_publishes_a_new_root_certificatecargo nextest run -p minimal grant_box_create_request_carries_the_published_root_certificatecargo nextest run -p minimal box_spec_shows_the_root_certificate_fingerprintVerify
min task run agent-verifyexited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Closes #2437