Skip to content

feat(bep): T130 — Hold the proxy's keys in Secret Service where the host has no usable TPM - #3330

Merged
norrietaylor merged 12 commits into
mainfrom
agent/3325-hold-the-proxy-s-keys-in-secret-service-where-th
Nov 13, 2026
Merged

norrietaylor merged 12 commits into
mainfrom
agent/3325-hold-the-proxy-s-keys-in-secret-service-where-th

Conversation

@minimal-foundry

Copy link
Copy Markdown
Contributor

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: bep logs one line for each key it generates or loads from Secret Service, with the role, the key's fingerprint and store=secret-service
layers:
- 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, as signin.rs holds the sign-in, under the role's label, with the locked and unreachable cases as KeyErrors that name the role and keep the key
- crates/bep/src/lib.rs: declares the secret_service module for Linux targets
- crates/bep/src/keys.rs: StartError prints the locked and unreachable refusals above, and names no replacement
test: 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 name bep --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 serve on 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 changed missing_in cfg now also includes Linux, and the function is pub(crate), so the new store can use it.

Tests

line exit tail
cargo nextest run -p bep a_locked_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Comp
cargo nextest run -p bep an_unreachable_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-1 in box runtime-implement-test-1-1... Fin

Verify

min task run agent-verify passed ([tasks.verify]).

Closes #3325

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

coderabbitai Bot commented Nov 12, 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: 77a29d7d-bdc2-498a-b7fd-01871220921f

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

@minimal-foundry

minimal-foundry Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at a382d4345e5a.

@norrietaylor resolved the last thread, which releases the approval this review had withheld.

Nothing to do.

@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 — 2 findings, 2 inline.

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

Comment thread crates/bep/src/secret_service.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 · 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.

Comment thread crates/bep/src/secret_service.rs Resolved
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.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p bep a_locked_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Comp
cargo nextest run -p bep an_unreachable_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-1 in box runtime-implement-test-1-1... Fin

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/bep/src/secret_service.rs: run now waits for secret-tool after a failed write and returns its output when it failed, so store() sorts its stderr into the locked and unreachable refusals. The new test a_tool_that_fails_before_it_reads_the_key_is_sorted_by_cause pins this.

With a fake secret-tool, the proxy's keys are generated and held in Secret Service. A locked or unreachable keyring refuses to start, keeps the keys and names what to do. This is now also true when secret-tool store exits before it reads the key.

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.

@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 — 5 findings, 5 inline.

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

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

Comment thread crates/bep/src/secret_service.rs Resolved
Comment thread crates/bep/src/secret_service.rs Resolved
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.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on the runtime's review findings, pushed as e6f78571077a.

line exit tail
cargo nextest run -p bep a_locked_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Comp
cargo nextest run -p bep an_unreachable_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-1 in box runtime-implement-test-1-1... Fin

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/bep/src/secret_service.rs: lookup now runs secret-tool search service <label> (no --unlock) on a silent exit 1 and returns KeyError::Locked when it lists an item. Pinned by a_silently_locked_lookup_refuses_start_and_keeps_the_keys.
  • 👍 valid — crates/bep/src/secret_service.rs: run now waits at most 60 s (TIMEOUT), kills the child, and returns KeyError::Locked. Pinned by a_tool_that_does_not_finish_reads_as_locked.
  • 👍 valid — crates/bep/src/secret_service.rs:306: Dropped the bare 'dbus', 'd-bus', 'no such file or directory' and 'connection refused' patterns and the bare 'locked'. The lists now hold full libsecret/GDBus phrases, such as 'locked object' and 'could not connect:'. The test checks that unrelated messages sort as Store.
  • 👍 valid — crates/bep/src/secret_service.rs:215: lookup and clear treat a silent failure as no match only on exit code 1. A signal or another code is KeyError::Store with the exit status. Pinned by a_lookup_that_fails_with_no_message_is_not_an_empty_slot.
  • 👍 valid — crates/bep/src/secret_service.rs: Added the timeout that kills the child (see TIMEOUT and wait). The PATH lookup did not change. A program that can go first on the proxy user's PATH runs as that user, and it can already read these items from Secret Service. signin.rs uses the same lookup, and a fixed path breaks hosts like NixOS.
  • 👍 valid — crates/bep/src/secret_service.rs: Same fix as the C1 thread: before lookup reports no key, it asks secret-tool search whether an item is there, and a listed item is a Locked refusal.

With a fake secret-tool, the proxy's keys are generated and held in Secret Service. A locked keyring (one that reports the lock, one that fails silently after a dismissed prompt, or one whose call does not finish) and an unreachable Secret Service refuse the start. They keep the keys and name what to do.

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 lookup miss is an empty slot only on exit code 1, and only when secret-tool search without --unlock lists no item. A listed item is Locked. Any other silent failure, a signal for example, is KeyError::Store. clear follows the same exit-code rule. The real secret-tool search exit code for no match is not checked on a real host. The code accepts exit 0 with empty output or exit 1 with no message. The PATH part of thread PRRT_kwDOPdfcxM62z7cz did not change the code (see its note). just clippy-strict and the full crate suite were not run.

@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 — 2 findings, 2 inline.

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

Comment thread crates/bep/src/secret_service.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 · 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.

Comment thread crates/bep/src/secret_service.rs Resolved
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.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on the runtime's review findings, pushed as 7da04290afe0.

line exit tail
cargo nextest run -p bep a_locked_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Comp
cargo nextest run -p bep an_unreachable_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-1 in box runtime-implement-test-1-1... Fin

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👎 invalid — crates/bep/src/secret_service.rs:347: Out of this task's layers. A new Custody::Software variant breaks the exhaustive match in crates/bep/src/ca.rs (line 724), which this task cannot touch. Also, exportable() == true alone makes a release build refuse every Secret Service key, and BEP-088 makes Secret Service the one allowed except
  • 👎 invalid — crates/bep/src/secret_service.rs:214: Already so on this branch. When lookup exits 1 with no stderr, it calls listed (lines 206-213). listed runs secret-tool search without --unlock and returns KeyError::Locked when the item is listed. The test a_silently_locked_lookup_refuses_start_and_keeps_the_keys pins this.
  • 👍 valid — crates/bep/src/secret_service.rs:297: The drain threads now report through a channel. After the child exits, run waits at most 1 s (DRAIN_GRACE), then takes the output read so far and leaves the thread detached. Test: a_pipe_held_open_after_exit_does_not_stop_the_start.

With a fake secret-tool, bep generates the proxy's root, sealing and signing keys as software P-256 keys and holds them in Secret Service. A restart loads the same keys. A locked or unreachable keyring refuses the start with the pinned refusal text, keeps every key and does not name bep --replace-key. A secret-tool that leaves its pipes open after it exits no longer stops the start.

Notes from the agent: Round 3. One change: run now waits at most one second for the output pipes after secret-tool exits, and then uses the output it read. The new test a_pipe_held_open_after_exit_does_not_stop_the_start pins it. All 10 secret_service tests pass. Thread C1 was not changed: a new Custody variant breaks the exhaustive match in crates/bep/src/ca.rs, which is outside this task's layers. The software-key report is BEP-090, a different task. Thread C2 was not changed: the branch already does what it asks.

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

@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 · 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.

Comment thread crates/bep/src/secret_service.rs Resolved
Comment thread crates/bep/src/secret_service.rs Resolved
@norrietaylor

Copy link
Copy Markdown
Member

/revise arch C1 (ruling 1202 at 7da0429; threads PRRT_kwDOPdfcxM620m85, PRRT_kwDOPdfcxM620m86): the output drain fails open.

Evidence, crates/bep/src/secret_service.rs at 7da0429:

  • Lines 143-148 and 285-298: Drain::collect logs "an output pipe of secret-tool stayed open after it exited; using the output read so far" and returns the partial buffer. run then returns Ok(out) (line 158). If the reader thread has not read the key yet, lookup sees blank stdout.
  • Line 228: lookup returns Ok(None) for exit 0 with blank stdout. A held key then reads as missing, and the start names --replace-key or generates over the held item. This breaks Gatehouse §6.10 line 832 and design principle 7.

Do:

  1. Drain::collect returns the bytes and whether the pipe reached its end by the deadline.
  2. SecretService::run never returns Ok(out) when either pipe did not reach its end. It returns failure(role, &out) when the stderr read so far is not blank. Otherwise it returns KeyError::Store with a detail that says an output pipe of secret-tool stayed open.
  3. In lookup, exit 0 with blank stdout returns unreadable(role), not Ok(None). Only exit 1 with blank stderr and no listed item is an empty slot.
  4. Add the test a_lookup_whose_pipe_stays_open_is_not_an_empty_slot: a fake secret-tool that starts sleep 30 & and exits 0 with no output, or exits 1 with no message, makes lookup return Err, not Ok(None).

Do not change SecretServiceKey::exportable() in this round. The arch question on it (threads PRRT_kwDOPdfcxM62z7rm, PRRT_kwDOPdfcxM620Snl) is with the arch reviewer.

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.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 4 of 10 on a /revise note, pushed as 167aa3881fb5.

line exit tail
cargo nextest run -p bep a_locked_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Comp
cargo nextest run -p bep an_unreachable_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-1 in box runtime-implement-test-1-1... Fin

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👎 invalid — crates/bep/src/secret_service.rs:397: Not changed in this round. The /revise note for this round holds exportable() for the arch reviewer, so this verdict records a deferral, not a ruling on the finding. The software-custody case it needs belongs to the BEP-088 store-choice task.
  • 👍 valid — crates/bep/src/secret_service.rs:146: Drain::collect now reports whether the pipe reached its end; run returns failure(role, &out) or KeyError::Store when either pipe stayed open, never Ok.
  • 👍 valid — crates/bep/src/secret_service.rs:228: lookup returns unreadable(role) for exit 0 with blank stdout; only exit 1 with blank stderr and no listed item is an empty slot.

With a fake secret-tool, the proxy's keys are generated and held in Secret Service. A locked or unreachable keyring refuses the start, keeps the keys and names what to do. A secret-tool whose output pipe stays open, or a lookup that exits 0 with no secret, now fails the start and is never read as an empty slot.

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 secret-tool stayed open. lookup returns unreadable(role) for exit 0 with blank stdout. The test a_pipe_held_open_after_exit_does_not_stop_the_start now expects the Unreachable error from run. I added a_lookup_whose_pipe_stays_open_is_not_an_empty_slot (exit 0 and exit 1 variants) and a_lookup_that_exits_0_with_no_secret_is_not_an_empty_slot. SecretServiceKey::exportable() is unchanged, as the note asks.

@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 — 2 findings, 2 inline.

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

@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

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.

@norrietaylor

Copy link
Copy Markdown
Member

/revise arch C1 (re-ruling on threads PRRT_kwDOPdfcxM62z7rm, PRRT_kwDOPdfcxM620Snl; supersedes ruling 1202 on this point): SecretServiceKey::exportable() misstates custody.

Evidence: HeldKey::exportable is documented as "Whether the store lets the private half out" (crates/bep/src/keys.rs). keys::custody maps false to Custody::Held, documented "The key is non-exportable". secret_service.rs lines 8-10 say any program of the proxy's user can read these keys. Gatehouse §6.10 line 837.

Do:

  1. In crates/bep/src/secret_service.rs, impl HeldKey for SecretServiceKey: exportable() returns true. Its doc comment says Secret Service lets the private half out to any program of the proxy's user (§6.10 line 837).
  2. Add the test secret_service_key_is_exportable to the #[cfg(test)] module. It asserts exportable() is true and keys::custody(&key, Build::Release) == Custody::Refused.
  3. Do not change keys.rs and do not add a Custody variant. The store-level software custody is deferred to T131: https://github.com/gominimal/inbox/issues/1251

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. The container platform had no instance to give the coder: its pool of prepared containers was full, which happens most just after a deploy. Your note is kept and asked again every 10 minutes for up to 30; a wait that outlives that is refused here with the reason.

What the platform said

could 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.

@norrietaylor

Copy link
Copy Markdown
Member

/revise push one empty commit to this branch, with no other change.

Evidence: round 5 pushed e72bad32 to agent/3325-hold-the-proxy-s-keys-in-secret-service-where-th at 22:15Z. As of 22:36Z, GitHub still shows the PR head as 167aa388, mergeable is unknown, and there are no check runs or workflow runs on e72bad32. GitHub did not sync that push to the PR, and githubstatus shows no incident. A new push re-triggers the sync.

Do: git commit --allow-empty -m "chore: re-sync PR head after round 5", then push. Change no file. The tests from round 5 stand.

@norrietaylor

Copy link
Copy Markdown
Member

/revise re-sync only: GitHub did not sync round 5's push to this PR.

Evidence: the branch is at e72bad323ab9 (pushed 22:15Z), but the PR head still reads 167aa3881fb5, mergeable is unknown, and no check or workflow has run on e72bad323ab9. The last task status reports branch_moved against 167aa3881fb5. githubstatus shows no incident.

Do: push one empty commit on top of e72bad323ab9 (git commit --allow-empty -m "chore: re-sync the pull request head"). Change no file. Round 5's exportable() fix and the drain fix stay as they are.

norrietaylor added a commit that referenced this pull request Nov 12, 2026

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

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

@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 (security, supply-chain); did not complete: correctness.

@norrietaylor

Copy link
Copy Markdown
Member

/revise arch conditions C1 and C2 (arch_rulings 1217 at a1d4ce0, job 057c8123): keep exportable() true, and make custody store-aware so a release build holds a Secret Service key.

Evidence: keys::custody decides only on exportable(). With true, a release build's load_with refuses a stored Secret Service sealing key with StartError::Exportable and names bep --replace-key, and the replacement is generated in Secret Service again, so the refusal repeats. A host with no TPM then cannot run a release proxy, which contradicts BEP-088, BEP-089 and Gatehouse §6.10 line 837. The test secret_service_key_is_exportable pins that refusal.

Do:

  1. C1, crates/bep/src/keys.rs: add fn software_store(&self) -> bool { false } to HeldKey. Add the variant Custody::Software ("the store holds a software key by design, BEP-088, and BEP-090 reports it"). In custody(), return Custody::Software for a key whose software_store() is true, in both builds, before the exportable() match.
  2. C1, crates/bep/src/secret_service.rs: in impl HeldKey for SecretServiceKey, override software_store() to return true. Keep exportable() as true. Change its doc comment (lines 409-411) to say custody holds the key as a software key, not that it refuses it.
  3. Then load_with returns no StartError::Exportable for a Secret Service key, keep_generated keeps it, and the debug-build warning "kept the proxy's {role} key although the keychain made it exportable" does not print for it.
  4. C2: replace the test secret_service_key_is_exportable with a_release_build_holds_a_secret_service_key. It asserts key.exportable() and custody(&key, Build::Release) == Custody::Software, and that keys::load_with over the fake secret-tool store, with each key answering Build::Release from build(), loads a stored sealing key with no StartError::Exportable.
  5. C2: add a keys.rs test that an exportable key that is not a Secret Service key is still Custody::Refused in Build::Release, so the macOS keychain rule stays hard.

Change files only in this task's layers (secret_service.rs, lib.rs, keys.rs). If a new Custody variant forces a match arm in another file, add only that arm and name the file in the round's summary.

@minimal-foundry

Copy link
Copy Markdown
Contributor Author

That /revise is held, not dropped. The container platform had no instance to give the coder: its pool of prepared containers was full, which happens most just after a deploy. Your note is kept and asked again every 10 minutes for up to 30; a wait that outlives that is refused here with the reason.

What the platform said

could 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 bryan-minimal 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.

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-tool is found on PATH. 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-tool that 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.

@norrietaylor
norrietaylor force-pushed the agent/3325-hold-the-proxy-s-keys-in-secret-service-where-th branch from a1d4ce0 to e72bad3 Compare November 13, 2026 14:45

@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

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.

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

@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/bep/src/secret_service.rs Resolved
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.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 9 of 10 on the runtime's review findings, pushed as 28d7bfe4b23c.

line exit tail
cargo nextest run -p bep a_locked_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Comp
cargo nextest run -p bep an_unreachable_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-1 in box runtime-implement-test-1-1... Fin

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/bep/src/secret_service.rs:412: The release-build refusal was real. I fixed it by the later thread's route: exportable() returns false, so custody holds the key in both builds. No Custody::Software variant, because ca.rs is outside this task's layers.
  • 👍 valid — crates/bep/src/secret_service.rs: Replaced the test with a_release_build_holds_a_secret_service_key. It asserts custody is Held (not Refused) in a release build for every role.
  • 👍 valid — crates/bep/src/secret_service.rs:412: exportable() returns false again, with the doc comment from 167aa38.
  • 👍 valid — crates/bep/src/secret_service.rs: Renamed the test to a_release_build_holds_a_secret_service_key. It asserts !key.exportable() and custody(&key, Build::Release) == Custody::Held.
  • 👍 valid — crates/bep/src/secret_service.rs: Code and notes agree now: exportable() is false, so load_with and the CA no longer refuse the key. A custody test for this key pins Custody::Held in both builds.

With a fake secret-tool, the proxy's keys are generated and held in Secret Service. A release build holds them and does not refuse them. A locked or unreachable keyring refuses the start, keeps the keys and names what to do.

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.

@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

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.

@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 — 3 findings, 3 inline.

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

Comment thread crates/bep/src/secret_service.rs Resolved
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.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

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

line exit tail
cargo nextest run -p bep a_locked_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-0 in box runtime-implement-test-0-1... Comp
cargo nextest run -p bep an_unreachable_secret_service_refuses_start 0 warning: unknown fields in task runtime-implement-test-0: network warning: unknown fields in task runtime-implement-test-1: network help: do you need to update to a newer version of minimal? Applying loadouts: default Running task runtime-implement-test-1 in box runtime-implement-test-1-1... Fin

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/bep/src/secret_service.rs:337: The drain thread now appends through append, which moves the bytes to a larger allocation and zeroes the old one before it is freed.

With a fake secret-tool, the proxy's keys are generated and held in Secret Service. A locked or unreachable login keyring refuses to start the proxy, keeps the keys, and names what to do.

Notes from the agent: Round 10 changes only the drain buffer in secret_service.rs. A new helper append grows the buffer by hand and zeroes the old allocation before it is freed. A unit test append_keeps_every_byte_across_growth pins that no bytes are lost. All 14 secret_service tests pass.

@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

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.

@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 — 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 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 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.rs lines 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 info line per key loaded or generated with role, fingerprint and store = "secret-service" (lines 466, 477).
  • Test lines: a_locked_secret_service_refuses_start and an_unreachable_secret_service_refuses_start exited 0. min task run agent-verify exited 0.
  • Custody: exportable() is false, and a_release_build_holds_a_secret_service_key pins Custody::Held. By the owner's ruling, the store-level software custody and exportable() == true belong to T131 (#3327). The arch check passes this head.

No findings.

@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 — 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.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 13, 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.

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.rs lines 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 info line per key loaded or generated with role, fingerprint and store = "secret-service" (lines 466, 477).
  • Test lines: a_locked_secret_service_refuses_start and an_unreachable_secret_service_refuses_start exited 0. min task run agent-verify exited 0.
  • Custody: exportable() is false, and a_release_build_holds_a_secret_service_key pins Custody::Held. By the owner's ruling, the store-level software custody and exportable() == true belong to T131 (#3327). The arch check passes this head.

No findings.

@norrietaylor

Copy link
Copy Markdown
Member

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 exportable() == false from arch ruling 1238 is permanent, and T131's plan (#3327) was rolled back to match. This PR merges as it is at a382d434: exportable() is false and a_release_build_holds_a_secret_service_key asserts Custody::Held. BEP-090's disclosure stays with T132 (#3328), through the store field in the published identity.

@norrietaylor
norrietaylor added this pull request to the merge queue Nov 13, 2026

@mitodrummer mitodrummer 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.

Merged via the queue into main with commit 9cdeca4 Nov 13, 2026
40 checks passed
@norrietaylor
norrietaylor deleted the agent/3325-hold-the-proxy-s-keys-in-secret-service-where-th branch November 13, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T130 — Hold the proxy's keys in Secret Service where the host has no usable TPM

3 participants