Repository navigation
feat(bep): T130 — Hold the proxy's keys in Secret Service where the host has no usable TPM - #3330
Conversation
Add a Secret Service key store for a Linux host with no usable TPM. It generates each proxy key as a software P-256 key and holds it through `secret-tool`, under the role's label. A locked keyring and an unreachable Secret Service refuse the start, keep the keys, and name what to do, with no replacement command (BEP-089).
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Approved: every review thread resolved at @norrietaylor resolved the last thread, which releases the approval this review had withheld. Nothing to do. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
The Secret Service store is in the right crate, and the explicit locked and unreachable refusals keep the keys as BEP-089 requires. One path fails open. lookup reads an exit 1 with empty stderr as "no key", and a dismissed unlock prompt on a locked keyring gives that result. Then the start names bep --replace-key or overwrites the held key. Gatehouse §6.10 line 832 says the sealing key changes only by re-enrollment. Make the change in C1.
Ruled at c7d6a14 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
When secret-tool store fails before it reads the key, the write gets a broken pipe. Wait for the tool and classify its exit and error output, so a locked or unreachable keyring prints its refusal on the first start.
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
With a fake Notes from the agent: Revise round 1: SecretService::run now waits for the tool after a failed write. If the tool failed, run returns its output so that the caller classifies stderr as Locked, Unreachable or Store. A write failure with a successful exit stays a Store error. The new test sends 1 MiB to a fake that exits without reading, so the broken pipe always happens. cargo clippy -p bep --all-targets is clean. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The locked and unreachable refusals conform. They keep the key and do not name bep --replace-key. Two items stay open. SecretServiceKey::exportable() returns false for a key that Secret Service lets out, so the custody rule records it as non-exportable (§6.10 line 837). Make the exception explicit in custody() with C1. A dismissed unlock prompt reads as a lost key, and the start then tells the operator to replace a key that still exists. Fix that in lookup with C2.
Ruled at 1921d6e against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
Kill a secret-tool call that outlives 60 s and refuse the start as a locked keyring, so an unanswered unlock prompt never hangs the proxy. Read a lookup as an empty slot only on exit 1 with no message, and only when `secret-tool search` lists no item. A listed item is a locked one. Narrow the error phrases that sort a failure as locked or unreachable.
…roxy-s-keys-in-secret-service-where-th
|
Round 2 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
With a fake Notes from the agent: Revise round 2. Only crates/bep/src/secret_service.rs changed. A secret-tool call now has a 60 s limit (SecretService::with_timeout overrides it for tests). A call that outlives the limit is killed and is a Locked refusal. Stdout and stderr drain on their own threads. A silent |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
The Secret Service store and its locked and unreachable refusals conform to BEP-089. They fail closed, keep the keys, and do not name a replacement. One point blocks the merge. SecretServiceKey::exportable() returns false, so the custody gate records a key that any program of the user can copy as non-exportable. Gatehouse §6.10 line 837 says non-exportable custody means no export. Make exportable() return true as C1 says, and leave the release gate closed until the store-choice task adds a software-custody case.
Ruled at e6f7857 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
A process that secret-tool starts, such as an autolaunched D-Bus daemon, can hold its pipes open. The drain now waits one second after the tool exits and then uses the output it read.
|
Round 3 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
With a fake Notes from the agent: Round 3. One change: |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
The refusals for a locked or unreachable keyring conform, and the new store is in the right place. The new output drain fails open. When the grace ends before the reader thread reads the output, run returns the partial output as a success. Then lookup reads a held key as an empty slot. Gatehouse §6.10 line 832 keeps the key unchanged except by re-enrollment, and principle 7 makes the store safe by default. Make the change in C1: an incomplete drain is a refusal, and a lookup that exits 0 with no output is unreadable, not empty.
Ruled at 7da0429 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
|
/revise arch C1 (ruling 1202 at 7da0429; threads PRRT_kwDOPdfcxM620m85, PRRT_kwDOPdfcxM620m86): the output drain fails open. Evidence,
Do:
Do not change |
…roxy-s-keys-in-secret-service-where-th
A pipe that is still open after secret-tool exits can still carry the key, so run() no longer returns the partial output as the whole answer. A lookup that exits 0 with no secret is now unreadable, not an empty slot.
|
Round 4 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
With a fake Notes from the agent: Round 4. Drain::collect now returns the bytes and whether the pipe reached its end. SecretService::run returns failure(role, &out) when a pipe stays open and stderr is not blank, otherwise KeyError::Store with a detail that says an output pipe of |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head conforms to Gatehouse §6.10 and to design principle 7. A locked keyring or an unreachable Secret Service refuses the start. The refusal keeps every key and does not name bep --replace-key. The compare from 7da04290 closes the last two fail-open lookup paths: an output pipe that stays open, and exit 0 with no secret. The selection of this store at start is BEP-088's task, and the report of software custody is BEP-090's.
Ruled at 167aa38 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
|
/revise arch C1 (re-ruling on threads PRRT_kwDOPdfcxM62z7rm, PRRT_kwDOPdfcxM620Snl; supersedes ruling 1202 on this point): Evidence: Do:
|
|
That What the platform saidcould not start the coder: Error: there is no container instance that can be provided to this durable object Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
…roxy-s-keys-in-secret-service-where-th
|
/revise push one empty commit to this branch, with no other change. Evidence: round 5 pushed Do: |
|
/revise re-sync only: GitHub did not sync round 5's push to this PR. Evidence: the branch is at Do: push one empty commit on top of |
GitHub did not sync the push of e72bad3 to #3330; see gominimal/agent-runtime#496.
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The change reports a Secret Service key as exportable, and that is true. But keys::custody decides only on that flag, so a release build now refuses every Secret Service key. A host with no TPM then cannot start a release proxy, and the refusal tells the operator to run bep --replace-key, which refuses again. Gatehouse §6.10 line 837 makes hardware custody a SHOULD where the host offers it. BEP-059 and BEP-089 keep Secret Service as the one exception. Make custody store-aware as C1 says, and replace the test as C2 says.
Ruled at a1d4ce0 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
|
/revise arch conditions C1 and C2 (arch_rulings 1217 at a1d4ce0, job 057c8123): keep Evidence: Do:
Change files only in this task's layers ( |
|
That What the platform saidcould not start the coder: Error: there is no container instance that can be provided to this durable object Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
bryan-minimal
left a comment
There was a problem hiding this comment.
Read at a1d4ce0 (the restored tree is identical to round 5's, checked by diff), with a lab run.
The store fails closed everywhere it matters. The private half travels to secret-tool on stdin, base64, never in argv; the label and attribute are the role's fixed strings. A lookup that exits 1 with nothing is asked a second question (search, which lists a locked item without its secret), so a dismissed unlock prompt reads as Locked, not as an empty slot; exit 0 with no secret is unreadable, not a key; an output pipe still open after exit fails the call rather than trusting a partial read; and a call past the timeout is killed and read as locked. Both refusals keep the keys and name no --replace-key, which is what BEP-089 asks. relabel writes the new slot before clearing the old, so a failure leaves the key where it was.
Lab, Linux: the CI mirror (workspace nextest with the new store's tests against the fake tool, the native daemon e2e, clippy, doctests, deny, machete, miri, kani) passes at this tree except commitlint, which flags a 130-column body line in the "restore round 5's tree" commit; GitHub's own commitlint check shows the same, and a squash merge drops it. The baseline holds on Ubuntu 24.04.
Round 5's one change is right: a Secret Service key reports itself exportable, since the service hands the private half to any program of the user, so custody refuses it in a release build. That means this store serves development builds until the custody rule gains a per-box answer, and the module says so.
Two notes, neither blocking:
secret-toolis found onPATH. The proxy runs as the operator, so that is the same trust the sign-in store already has; worth the same line in the module doc that says so, and the per-box custody ticket is where the stronger answer lives.- The timeout kills a
secret-toolthat is waiting on a desktop unlock prompt, so the operator who was about to answer it sees the proxy refuse instead. Sixty seconds is a fair window; the refusal text could say the prompt was closed.
a1d4ce0 to
e72bad3
Compare
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
Commit e72bad32 makes SecretServiceKey::exportable() return true. Then custody refuses every Secret Service key in a release build. A release proxy on a Linux host with no usable TPM then cannot start. Gatehouse §6.10 line 837 asks for hardware custody only where the host offers it. BEP-014, BEP-059 and BEP-088 make Secret Service the release-build exception, and BEP-090 reports the reduced custody. Return false again (C1), and make the test pin the exception (C2).
Ruled at e72bad3 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
…roxy-s-keys-in-secret-service-where-th
Secret Service is the one software store that BEP-088 allows, and BEP-014 and BEP-059 exempt it. Report its key as non-exportable, so custody holds it and a release build on a host with no TPM starts.
|
Round 9 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
With a fake Notes from the agent: This round reverts e72bad3. SecretServiceKey::exportable() returns false again, with the doc comment from 167aa38. The test that pinned Custody::Refused is now a_release_build_holds_a_secret_service_key. It asserts !exportable() and Custody::Held in both builds, for every role. The older C1 thread asked for a new Custody::Software variant. I did not add it, because the newer C1 thread asks for false, and a new variant also needs changes in ca.rs, which is outside the layers. No test of load_with in a release build was added: SecretServiceKey answers the binary's own build, and custody is Held for a non-exportable key in every build. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head conforms to Gatehouse §6.10 line 837. The design asks for hardware custody only where the host offers it. The spec records Secret Service as the exception for a Linux host with no usable TPM. SecretServiceKey::exportable() returns false again, so a release build holds a Secret Service key and does not refuse it. The earlier PASS on 167aa388 accepted the same value. No conditions.
Ruled at 28d7bfe against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
A Vec that grows by extend_from_slice frees its old allocation without zeroing it, so a key read from secret-tool can stay in freed memory. The drain now moves the bytes to a new allocation by hand and zeroes the old one first.
|
Round 10 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
With a fake Notes from the agent: Round 10 changes only the drain buffer in secret_service.rs. A new helper |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head adds one commit to the head that passed. When the secret-tool drain buffer grows, the commit zeroes the old allocation. Gatehouse N3 (line 92) requires zeroize on private key material, and this change puts that rule into effect. The commit does not change the store, the refusals or the log lines. The PASS on 28d7bfe4 applies to all other parts of the change.
Ruled at a382d43 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 6 unresolved threads — minimal-arch[bot] crates/bep/src/secret_service.rs:428, minimal-arch[bot] crates/bep/src/secret_service.rs, minimal-arch[bot] crates/bep/src/secret_service.rs:428, minimal-arch[bot] crates/bep/src/secret_service.rs, minimal-foundry[bot] crates/bep/src/secret_service.rs, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter review of a382d434 against T130's plan block (#3325) and its test lines.
Conforms
- Layers:
crates/bep/src/secret_service.rs(new),crates/bep/src/lib.rs,crates/bep/src/keys.rs. No file outside the layers. - Diagnostics:
keys.rslines 450 and 454 print the two pinned refusals word for word, and neither names a replacement key. - Store: the locked and unreachable cases are
KeyErrors that name the role and keep the key. A call that outlives its timeout reads as locked. An output pipe that stays open fails the call, and does not read as an empty slot. - Observability: one
infoline per key loaded or generated withrole,fingerprintandstore = "secret-service"(lines 466, 477). - Test lines:
a_locked_secret_service_refuses_startandan_unreachable_secret_service_refuses_startexited 0.min task run agent-verifyexited 0. - Custody:
exportable()isfalse, anda_release_build_holds_a_secret_service_keypinsCustody::Held. By the owner's ruling, the store-level software custody andexportable() == truebelong to T131 (#3327). The arch check passes this head.
No findings.
There was a problem hiding this comment.
minimal-review — approved
Verdict APPROVE — every review thread is resolved; @norrietaylor closed the last one. The review of a382d4345e5a withheld this approval on the threads open then. Posted as a comment: the App cannot approve its own pull request; the check and the label carry it.
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter review of a382d434 against T130's plan block (#3325) and its test lines.
Conforms
- Layers:
crates/bep/src/secret_service.rs(new),crates/bep/src/lib.rs,crates/bep/src/keys.rs. No file outside the layers. - Diagnostics:
keys.rslines 450 and 454 print the two pinned refusals word for word, and neither names a replacement key. - Store: the locked and unreachable cases are
KeyErrors that name the role and keep the key. A call that outlives its timeout reads as locked. An output pipe that stays open fails the call, and does not read as an empty slot. - Observability: one
infoline per key loaded or generated withrole,fingerprintandstore = "secret-service"(lines 466, 477). - Test lines:
a_locked_secret_service_refuses_startandan_unreachable_secret_service_refuses_startexited 0.min task run agent-verifyexited 0. - Custody:
exportable()isfalse, anda_release_build_holds_a_secret_service_keypinsCustody::Held. By the owner's ruling, the store-level software custody andexportable() == truebelong to T131 (#3327). The arch check passes this head.
No findings.
|
Correction to my review 5894342778 and my replies on threads PRRT_kwDOPdfcxM624Mx4 and PRRT_kwDOPdfcxM624Mx9: the store-level software custody does not move to T131. The owner ruled that |
T130 — Hold the proxy's keys in Secret Service where the host has no usable TPM
slice: S18
kind: task
covers: BEP-089
size: M
est: 260 code, 200 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: each refusal prints to the person who started
bep, pinned by its test: "The proxy did not start: the login keyring is locked, and it holds the proxy's key. Unlock the login keyring, then start the proxy again." and "The proxy did not start: Secret Service cannot be reached from this session, and it holds the proxy's key. Start the proxy from the desktop session that holds the login keyring."observability:
beplogs one line for each key it generates or loads from Secret Service, with the role, the key's fingerprint andstore=secret-servicelayers:
- store:
- crates/bep/src/secret_service.rs (new): a key store that generates each proxy key as a software P-256 key and holds it in Secret Service through
secret-tool, assignin.rsholds the sign-in, under the role's label, with the locked and unreachable cases asKeyErrors that name the role and keep the key- crates/bep/src/lib.rs: declares the
secret_servicemodule for Linux targets- crates/bep/src/keys.rs:
StartErrorprints the locked and unreachable refusals above, and names no replacementtest: cargo nextest run -p bep a_locked_secret_service_refuses_start
test: cargo nextest run -p bep an_unreachable_secret_service_refuses_start
produces:
- crates/bep/src/secret_service.rs
consumes: none
proof: With a fake
secret-tool, the proxy's keys are generated and held in Secret Service, and a locked or unreachable keyring refuses to start, keeps the keys and names what to do.Proof
With a fake
secret-tool(the tests in crates/bep/src/secret_service.rs), the proxy's three keys are generated as software P-256 keys and held as Secret Service items labelled dev.gominimal.bep.. A restart loads the same keys. A locked keyring or an unreachable Secret Service refuses the start with the two pinned messages, which do not namebep --replace-key, and the keys are unchanged when the keyring comes back.Notes from the agent: The new store is not yet chosen at start:
bep serveon Linux does not use it. The store choice (TPM first, then Secret Service) is BEP-088 and is outside this task's layers. SecretServiceKey::exportable() returns false. The custody rule refuses an exportable key in a release build, and BEP-088 requires a software key here, so a true value would make a release build refuse every Secret Service key. BEP-090 reports the reduced custody. secret-tool errors are put into a class by their stderr text: 'locked' is the locked class, and D-Bus or missing-service text is the unreachable class. If a person dismisses an unlock prompt, libsecret can return no item and no error. In that case a lookup reads as 'no key', and load_with reports the key as missing. The refusal for an unreachable store says 'it holds the proxy's key' also on a first start. That wording is copied from the task's diagnostics line. The task's load line has no store field, so a generated key gets two log lines: the store's line with store=secret-service, and the existing 'generated a proxy key' line in load_with. The changedmissing_incfg now also includes Linux, and the function is pub(crate), so the new store can use it.Tests
cargo nextest run -p bep a_locked_secret_service_refuses_startcargo nextest run -p bep an_unreachable_secret_service_refuses_startVerify
min task run agent-verifypassed ([tasks.verify]).Closes #3325