Skip to content

feat(bep): issue and publish the host root certificate and hand it to each grant box - #2493

Merged
norrietaylor merged 11 commits into
mainfrom
agent/2437-issue-and-publish-the-un-enrolled-host-root-cert
Oct 22, 2026
Merged

norrietaylor merged 11 commits into
mainfrom
agent/2437-issue-and-publish-the-un-enrolled-host-root-cert

Conversation

@minimal-foundry

Copy link
Copy Markdown
Contributor

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 label root CA certificate in place of the key thumbprint, pinned by box_spec_shows_the_root_certificate_fingerprint; a bep start whose held root key cannot sign refuses with a message naming bep --replace-key root
observability: one info log line at bep start naming the root certificate's fingerprint and the count of its permitted names, never a key
layers:
- issue:
- crates/bep/src/keys.rs: CaKey for the keychain-held key through SecKey::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 bep start 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 them
test: 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: Identity carries root_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: bep start and bep --replace-key root issue and publish the root certificate; bep serve keeps the issued root as the CA's anchor
test: 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 MintGrants step puts the identity's root_certificate on the create request for a grant box, and refuses a grant box whose identity publishes none with a message naming bep
- 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 spec shows its fingerprint.
depends on:
- blocked by T2
- blocked by T3
- blocked by T42


Generated by Claude Code

Proof

A bep start 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 as root_certificate (PEM) in ~/.minimal/bep/identity.json and logs its fingerprint and name count. bep --replace-key root publishes a new certificate under the new key. bep serve anchors 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 in root_certificate. min box spec prints root 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 KeychainKey through SecKey::create_signature with 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 implements CaKey. 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_spec is a private module of cmd, so tests.rs cannot reach render or root_fingerprint without a change to cmd/mod.rs, which is outside the layers. Behavior changes: (1) bep serve now uses the real CA (Ca::with_root over the issued root) in place of the NoSigningKey issuer that refused every leaf with 502. NoSigningKey moved 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_union in main.rs). (3) If the root key replacement cannot issue a certificate, `bep --replace-key r…[truncated]

Tests

line exit tail
cargo nextest run -p bep root_certificate_is_issued_from_the_held_root_key 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-ce80... Compiling bep v0.0.1 (/workbench/crates/bep) Finished 'test' profile [unoptimized] target(s) in 14.46s ──────────── Nextest run ID 8ac7c70f-148f-4161-b457-85127a77d6b2 with nexte
cargo nextest run -p bep keychain_root_key_signs_the_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-b936... Finished 'test' profile [unoptimized] target(s) in 0.31s ──────────── Nextest run ID ffe6f5a1-53df-4ee5-89a2-7a248dbd8c29 with nextest profile: default Starting 1 test across 2
cargo nextest run -p bep published_identity_carries_the_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-404d... Finished 'test' profile [unoptimized] target(s) in 0.33s ──────────── Nextest run ID 23d4c83a-3b1b-4394-8cc6-f847f3fadfa3 with nextest profile: default Starting 1 test across 2
cargo nextest run -p bep root_replacement_publishes_a_new_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-1220... Finished 'test' profile [unoptimized] target(s) in 0.39s ──────────── Nextest run ID 9920628a-a9e6-48c7-aabc-723d0235b1b0 with nextest profile: default Starting 1 test across 2
cargo nextest run -p minimal grant_box_create_request_carries_the_published_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-f154... Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc
cargo nextest run -p minimal box_spec_shows_the_root_certificate_fingerprint 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-e6ef... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify

min task run agent-verify exited 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.

the sandbox ran rustc (1.98.1), the repository pins 1.97.0 in rust-toolchain.toml; a failure here may be the newer toolchain's, not this change's
Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-b1bd...
    Checking rustls-webpki v0.103.16
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking args v0.0.1 (/workbench/crates/args)
    Checking paths v0.0.1 (/workbench/crates/paths)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
    Checking rustls v0.23.46
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking switch v0.0.1 (/workbench/crates/switch)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking tokio-rustls v0.26.5
    Checking hyper-rustls v0.27.9
    Checking rustls-platform-verifier v0.7.0
    Checking reqwest v0.13.5
    Checking tonic v0.14.6
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking google-cloud-auth v1.17.0
    Checking tonic-prost v0.14.6
    Checking opentelemetry-http v0.33.0
    Checking wait-timeout v0.2.1
    Checking opentelemetry-otlp v0.33.0
    Checking google-cloud-gax-internal v0.7.20
    Checking rusty-fork v0.3.1
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking rand_xorshift v0.4.0
    Checking google-cloud-longrunning v1.14.0
    Checking google-cloud-iam-v1 v1.13.0
    Checking google-cloud-lro v1.11.0
    Checking proptest v1.11.0
    Checking google-cloud-storage v1.20.0
    Checking common v0.0.1 (/workbench/crates/common)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Base

The base branch moved while the coder worked; it was merged in before the tests ran.

Closes #2437

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).
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 33912fc5-1b4d-49c8-92e0-5b9ba1371687

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@minimal-foundry

minimal-foundry Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewed: 1 finding, none blocking at 8289c5937d4b.

Address the comments on the diff.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Panel: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.

Comment thread crates/bep/src/main.rs Resolved

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread crates/bep/src/ca.rs Resolved
Comment thread crates/bep/src/publish.rs Resolved
Comment thread crates/bep/src/main.rs Resolved
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.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Panel: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.

Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings, pushed as aff93f3333f1.

line exit tail
cargo nextest run -p bep root_certificate_is_issued_from_the_held_root_key 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-7d83... Compiling bep v0.0.1 (/workbench/crates/bep) Finished 'test' profile [unoptimized] target(s) in 14.42s ──────────── Nextest run ID 7bfef84d-3a35-4784-8816-a437db9c2d24 with nexte
cargo nextest run -p bep keychain_root_key_signs_the_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-60be... Finished 'test' profile [unoptimized] target(s) in 0.32s ──────────── Nextest run ID bb5c2c74-d791-4da4-bef2-cc8990aa5337 with nextest profile: default Starting 1 test across 2
cargo nextest run -p bep published_identity_carries_the_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-b317... Finished 'test' profile [unoptimized] target(s) in 0.31s ──────────── Nextest run ID 7bde326e-b56c-4e7f-a50d-b7d7076e37c1 with nextest profile: default Starting 1 test across 2
cargo nextest run -p bep root_replacement_publishes_a_new_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-f9f0... Finished 'test' profile [unoptimized] target(s) in 0.31s ──────────── Nextest run ID 20d6511c-c6be-4293-9a8e-774800ca5ece with nextest profile: default Starting 1 test across 2
cargo nextest run -p minimal grant_box_create_request_carries_the_published_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-ddea... Compiling ot v0.0.1 (/workbench/crates/ot) Compiling args v0.0.1 (/workbench/crates/args) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc
cargo nextest run -p minimal box_spec_shows_the_root_certificate_fingerprint 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-486d... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify exited 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.

uncate v2.0.1
    Checking opentelemetry-appender-tracing v0.33.0
    Checking kasuari v0.4.12
    Checking hash32 v0.3.1
    Checking yasna v0.6.0
    Checking module-lattice v0.2.3
    Checking lru v0.18.2
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking kem v0.3.0
    Checking compression-core v0.4.33
    Checking size v0.5.0
    Checking data-encoding v2.11.1
    Checking sponge-cursor v0.1.0
    Checking ml-kem v0.3.2
    Checking compression-codecs v0.4.45
    Checking sha3 v0.12.0
    Checking ratatui-core v0.1.2
    Checking heapless v0.9.3
    Checking rcgen v0.14.10
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking ssh-key v0.7.0-rc.11
    Checking signal-hook-mio v0.2.5
    Checking generic-array v1.4.4
    Checking derive_more v2.1.1
    Checking russh-cryptovec v0.62.0
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking num-bigint v0.5.1
    Checking russh-util v0.52.0
    Checking tagptr v0.2.0
    Checking constcat v0.6.1
    Checking bitflags v1.3.2
    Checking hex-literal v1.1.0
    Checking managed v0.8.0
    Checking tinyvec_macros v0.1.1
    Checking russh v0.63.3
    Checking smoltcp v0.14.0
    Checking tinyvec v1.12.0
    Checking moka v0.12.16
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking crossterm v0.29.0
    Checking async-compression v0.4.50
    Checking async-tar v0.6.1
    Checking graph v0.0.1 (/workbench/crates/graph)
    Checking line-clipping v0.3.8
    Checking object v0.40.0
    Checking is_executable v1.0.6
    Checking clap_complete v4.6.11
    Checking ratatui-widgets v0.3.2
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking hickory-proto v0.26.3
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking sysinfo v0.39.6
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking ratatui-macros v0.7.2
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking lcache v0.0.1 (/workbench/crates/lcache)
    Checking ratatui-crossterm v0.1.2
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Review threads the coder judged:

  • 👍 valid — PRRT_kwDOPdfcxM6vXLZe: Identity::issuing_root now caps the root certificate at root_not_after through new ca::issue_root_until. Ca::reissue_root keeps the same end, and a root past its end refuses with bep --replace-key root. Pinned by root_certificate_ends_at_the_root_key_validity_end. (not posted on the thread: not an open thread on the pull request)

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 min box spec shows its fingerprint.

Notes from the agent: Revise round 1. The four bep test lines passed in one run filtered on root_certificate, which selects all four. That run also included the new test ca::tests::root_certificate_ends_at_the_root_key_validity_end. The full bep suite passed: 137 tests. New printed text: a start whose root is past its end prints The proxy did not start: the root CA expired at <time>. Run bep --replace-key root to make a new root key. Boxes created before then must be re-created. When the identity carries no root_not_after (a root key of unknown age), the certificate still ends ten years from now. A mint refuses such an identity until the root key is replaced.

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

/revise Act on the review's security finding at aff93f33 on crates/minimal/src/cmd/boxes/create.rs (grant_root_certificate, thread 4353184913): the certificate is decoded but not checked against the published root key. Before the PEM goes on the create request, check that the certificate's SubjectPublicKeyInfo carries the key that identity.key(Role::Root) gives (the uncompressed SEC1 point), and refuse with the same bep-naming message when it does not. Keep the check to the key match: the name constraints are the proxy's to issue and the box's TLS stack to enforce, so no X.509 parser is needed in minimal. Pin it in grant_box_create_request_carries_the_published_root_certificate with a certificate under another key. If you find the check is wrong or the tradeoff was deliberate, say so on the thread and change nothing.


Generated by Claude Code

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.

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a /revise note, pushed as d86ef0408bf7.

line exit tail
cargo nextest run -p bep root_certificate_is_issued_from_the_held_root_key 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-123e... Updating crates.io index Downloading crates ... Downloaded core_detect v1.0.0 Downloaded bit-vec v0.10.1 Downloaded arbitrary v1.5.0 Downloaded borsh-derive v1.8.1 Downloa
cargo nextest run -p bep keychain_root_key_signs_the_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-9ea8... Finished 'test' profile [unoptimized] target(s) in 0.32s ──────────── Nextest run ID 145ccf68-8dc4-4fd3-94b9-cd80e2bec39b with nextest profile: default Starting 1 test across 2
cargo nextest run -p bep published_identity_carries_the_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-9329... Finished 'test' profile [unoptimized] target(s) in 0.30s ──────────── Nextest run ID 55f30b87-571a-4a60-a850-66e5c20e0149 with nextest profile: default Starting 1 test across 2
cargo nextest run -p bep root_replacement_publishes_a_new_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-513c... Finished 'test' profile [unoptimized] target(s) in 0.30s ──────────── Nextest run ID edcab7ca-9520-4274-892a-45f53c6d9d29 with nextest profile: default Starting 1 test across 2
cargo nextest run -p minimal grant_box_create_request_carries_the_published_root_certificate 0 piling hyper-util v0.1.20 Compiling google-cloud-type v1.6.0 Compiling toml-span v0.7.1 Compiling ot v0.0.1 (/workbench/crates/ot) Compiling jaq-fmts v0.1.1 Compiling hyper-rustls v0.27.9 Compiling hyper-timeout v0.5.2 Compiling reqwest v0.13.5 Compiling tonic v0.14.6 Comp
cargo nextest run -p minimal box_spec_shows_the_root_certificate_fingerprint 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-99d5... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify exited 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.

d-iam-v1 v1.13.0
    Checking tracing-appender v0.2.5
    Checking opentelemetry-otlp v0.33.0
    Checking json-subscriber v0.3.1
    Checking google-cloud-lro v1.11.0
    Checking bcrypt-pbkdf v0.11.0
    Checking ed25519-dalek v3.0.0
    Checking p384 v0.14.0
    Checking google-cloud-storage v1.20.0
    Checking p521 v0.14.0
    Checking opentelemetry-appender-tracing v0.33.1
    Checking unicode-truncate v2.0.1
    Checking ratatui-core v0.1.2
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking ssh-key v0.7.0-rc.11
    Checking russh-util v0.52.0
    Checking moka v0.12.16
    Checking russh v0.64.1
    Checking crossterm v0.29.0
    Checking async-compression v0.4.50
    Checking async-tar v0.6.1
    Checking ratatui-widgets v0.3.2
    Checking hickory-proto v0.26.3
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking bep v0.0.1 (/workbench/crates/bep)
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking ratatui-macros v0.7.2
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking ratatui-crossterm v0.1.2
    Checking dashmap v6.2.1
    Checking ratatui v0.30.2
    Checking inquire v0.9.4
    Checking russh-sftp v2.4.0
    Checking tokio-vsock v0.7.2
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking insta v1.49.0
    Checking wait-timeout v0.2.1
    Checking bit-vec v0.10.1
    Checking quick-error v1.2.3
    Checking bit-set v0.11.1
    Checking rusty-fork v0.3.1
    Checking rand_xorshift v0.5.0
    Checking core_detect v1.0.0
    Checking unarray v0.1.4
    Checking proptest v1.12.0
    Checking nickel-lang-core v0.19.0
    Checking args v0.0.1 (/workbench/crates/args)
    Checking common v0.0.1 (/workbench/crates/common)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking decode v0.0.1 (/workbench/crates/decode)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Review threads the coder judged:

  • 👍 valid — PRRT_kwDOPdfcxM6vXcGo: grant_root_certificate now refuses a certificate whose SubjectPublicKeyInfo is not the published root key (P-256, uncompressed point), with the same bep message. The name constraint stays the proxy's to issue and the box's TLS stack to enforce. The test pins a certificate under another key. (not posted on the thread: not an open thread on the pull request)

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. min box spec shows the certificate's fingerprint.

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 bep. The check does not use an X.509 parser, and it does not check the name constraints or the signature. Before the commit, a temporary test (now removed) ran the walker against a real openssl-issued P-256 certificate with a nameConstraints extension. It found the key, and it refused a key with one bit changed. The test now builds its certificate DER by hand in the shape that bep issues. It adds a certificate under another key to the refused cases. The failed tests check excerpt in the directive does not name a failing test. The six test lines pass here. I did not run the workspace suite, so I cannot say what failed in CI.

Copy link
Copy Markdown
Member

/revise CI's Linux native tests job fails at aff93f33 on two source-inventory tests in crates/minimal/src/tests.rs, both tripped by the create_request() helper this PR added near grant_box_create_request_carries_the_published_root_certificate. (1) cli_create_requests_use_the_constructor scans for the text CreateSessionRequest { and exempts it only when the text before it ends with ->; the helper's signature fn create_request() -> minimald_rpc::CreateSessionRequest { carries the path prefix, so it reads as a struct literal. Import CreateSessionRequest and write the return type as -> CreateSessionRequest {. (2) every_create_session_asserts_the_daemon_build lists every CreateSessionRequest::new( site with whether it sets .must_match_version = minimal_client::version_assertion(); the helper sets nothing, so the inventory gains tests.rs::create_request = asserts nothing and the expected list does not have it. Set request.must_match_version = minimal_client::version_assertion(); in the helper, as create_box_on does, and add "tests.rs::create_request = asserts" to the expected list after "tests.rs::create_box_on = asserts" with a one-line comment that it is a unit-test fixture, not a client path. Run cargo nextest run -p minimal cli_create_requests_use_the_constructor every_create_session_asserts_the_daemon_build to confirm.


Generated by Claude Code

…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 norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/minimal/src/cmd/boxes/create.rs Resolved
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on a /revise note, pushed as 8289c5937d4b.

line exit tail
cargo nextest run -p bep root_certificate_is_issued_from_the_held_root_key 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-c1f1... Compiling bep v0.0.1 (/workbench/crates/bep) Finished 'test' profile [unoptimized] target(s) in 12.08s ──────────── Nextest run ID cdda7e9a-6164-4830-9b6f-85a15d4d4f24 with nexte
cargo nextest run -p bep keychain_root_key_signs_the_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-b204... Finished 'test' profile [unoptimized] target(s) in 0.29s ──────────── Nextest run ID 52af5b20-1436-4f30-995a-762ebcb9b715 with nextest profile: default Starting 1 test across 2
cargo nextest run -p bep published_identity_carries_the_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-1359... Finished 'test' profile [unoptimized] target(s) in 0.32s ──────────── Nextest run ID b7bfc83b-66c5-4cb3-bc84-a90c2c640f60 with nextest profile: default Starting 1 test across 2
cargo nextest run -p bep root_replacement_publishes_a_new_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-cb13... Finished 'test' profile [unoptimized] target(s) in 0.31s ──────────── Nextest run ID 386ecef0-7117-48f6-8d54-02bbcd5f8748 with nextest profile: default Starting 1 test across 2
cargo nextest run -p minimal grant_box_create_request_carries_the_published_root_certificate 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-4add... Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling stdlib v0.0.22 (/workbenc
cargo nextest run -p minimal box_spec_shows_the_root_certificate_fingerprint 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-d425... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.

Verify min task run agent-verify exited 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.

here may be the newer toolchain's, not this change's
Applying loadouts: default
Running task runtime-implement-verify in session task-runtime-implement-verify-3422...
    Checking rustls-webpki v0.103.16
    Checking ot v0.0.1 (/workbench/crates/ot)
    Checking args v0.0.1 (/workbench/crates/args)
    Checking paths v0.0.1 (/workbench/crates/paths)
   Compiling stdlib v0.0.22 (/workbench/crates/stdlib)
   Compiling version v0.8.0 (/workbench/crates/version)
    Checking switch v0.0.1 (/workbench/crates/switch)
    Checking rustls v0.23.46
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
    Checking diagnostics v0.0.1 (/workbench/crates/diagnostics)
    Checking async-dialog v0.0.1 (/workbench/crates/async-dialog)
    Checking tokio-rustls v0.26.5
    Checking rustls-platform-verifier v0.7.0
    Checking wait-timeout v0.2.1
    Checking quick-error v1.2.3
    Checking hyper-rustls v0.27.9
    Checking tonic v0.14.6
    Checking bep v0.0.1 (/workbench/crates/bep)
    Checking bit-vec v0.10.1
    Checking reqwest v0.13.5
    Checking bit-set v0.11.1
    Checking tonic-prost v0.14.6
    Checking rusty-fork v0.3.1
    Checking rand_xorshift v0.5.0
    Checking unarray v0.1.4
    Checking google-cloud-auth v1.17.0
    Checking opentelemetry-http v0.33.1
    Checking core_detect v1.0.0
    Checking proptest v1.12.0
    Checking opentelemetry-otlp v0.33.0
    Checking google-cloud-gax-internal v0.7.20
    Checking mlog v0.0.1 (/workbench/crates/mlog)
    Checking google-cloud-longrunning v1.14.0
    Checking google-cloud-iam-v1 v1.13.0
    Checking google-cloud-lro v1.11.0
    Checking google-cloud-storage v1.20.0
    Checking common v0.0.1 (/workbench/crates/common)
    Checking boxes v0.0.1 (/workbench/crates/boxes)
    Checking sandbox v0.0.1 (/workbench/crates/sandbox)
    Checking mfile v0.0.1 (/workbench/crates/mfile)
    Checking minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
    Checking checkouts v0.0.1 (/workbench/crates/checkouts)
    Checking decode v0.0.1 (/workbench/crates/decode)
    Checking graph v0.0.1 (/workbench/crates/graph)
error: using `chunks_exact` with a constant chunk size
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    |
help: consider using `as_chunks::<2>()` instead
   --> crates/minimald-rpc/src/trace.rs:199:46
    |
199 |     for (byte, pair) in out.iter_mut().zip(s.chunks_exact(2)) {
    |                                              ^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#chunks_exact_to_as_chunks
    = note: `-D clippy::chunks-exact-to-as-chunks` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::chunks_exact_to_as_chunks)]`

error: could not compile `minimald-rpc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

Review threads the coder judged:

  • 👎 invalid — PRRT_kwDOPdfcxM6vX9iT: The identity file is mode 0600 and owner-checked before the read. Its only writer can also replace the published root key, so a self-signature or constraint check adds no barrier. The stale case, a certificate from before a root replacement, is the case the subject-key check in grant_root_certificat (not posted on the thread: not an open thread on the pull request)

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 min box spec shows its fingerprint. This round also makes the two source-inventory tests in crates/minimal/src/tests.rs pass again.

Notes from the agent: Revise round 3. The create_request() test fixture now imports CreateSessionRequest and returns -> CreateSessionRequest {. It also sets must_match_version = minimal_client::version_assertion(). The create-site inventory lists "tests.rs::create_request = asserts" with a comment that marks it as a unit-test fixture. cargo clippy -p minimal --all-targets reports no warnings in minimal. Its only warnings are 3 in the minimald lib, which this round does not touch. just clippy-strict was not run.

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 norrietaylor changed the title T43 — Issue and publish the un-enrolled host root certificate and hand it to each grant box feat(bep): issue and publish the host root certificate and hand it to each grant box Oct 22, 2026

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 22, 2026

Copy link
Copy Markdown
Member

The merge queue removed this PR at 22:55Z: the merge group's CI (Linux KVM) run (test-kvm job 120133224879) failed in the session e2e's "skip-lane scaffold" proof. The cause is not this PR's: min session exec failed because the guest minimald could not resolve cache.minimal.dev when it fetched a package closure (dns error, failed to lookup address), a transport failure to the remote cache in a proof this diff does not touch. The same KVM lane passed on this head at 8289c593 before the group ran. No fix exists to port, so this is the one re-run: re-enqueued once. A second failure is treated as real.


Generated by Claude Code

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit efb91c7 Oct 22, 2026
37 checks passed
@norrietaylor
norrietaylor deleted the agent/2437-issue-and-publish-the-un-enrolled-host-root-cert branch October 22, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T43 — Issue and publish the un-enrolled host root certificate and hand it to each grant box

1 participant