Repository navigation
test(bep): T133 — Linux hosts hold the proxy's keys, end to end - #3485
Conversation
Starts the bep binary with no tpm2-tools on PATH and a secret-tool that reports no session bus, and checks the refusal line and the exit code.
Starts the bep binary twice against the TPM that BEP_TPM_TCTI names, and checks that the published fingerprints match. With the TPM gone, the next start refuses and keeps the key files. With no TPM and no keyring, the start refuses. Both tests are ignored until the tpm lane runs them.
|
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: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The tests conform to Gatehouse §6.10 line 837. They prove that bep keeps its keys in the TPM across restarts and that it refuses to start when it has no key store. The refusal strings match crates/bep/src/keys.rs, and every refusal path fails closed. The two TPM legs did not run, so the TPM half of the proof is still open. C1 closes it: run the bep-tpm-integration lane on this head and put the job URL in the Deferred table.
Ruled at 5df6927 against gominimal/arch@327e1b57d16b by claude-opus-5-5.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/bep/tests/linux_custody_tpm_integration.rs:220, minimal-arch[bot] crates/bep/tests/linux_custody_tpm_integration.rs:297. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
Without a resource manager, each tpm2-tools command in the proof flushes every object in the TPM, and key_store_tpm_integration does the same from another nextest process. On the shared CI swtpm the two removed each other's loaded keys. When the named TPM has no resource manager and swtpm is on PATH, the restart proof now starts an swtpm of its own.
…s-hold-the-proxy-s-keys-end-to-end
|
Round 1 of 10 on a failed check suite, pushed as
Verify Review threads the coder judged:
On a Linux host with a TPM, the bep-tpm-integration lane starts Notes from the agent: Cause of the failed checks: bep-tpm-integration ran all _tpm_integration binaries at the same time against one swtpm. The test wrappers in linux_custody_tpm_integration.rs flush every transient object and session after each tpm2-tools command. TpmStore in key_store_tpm_integration does the same from another nextest process. Its in-process lock does not stop another process. So the two tests removed each other's loaded keys, and a_tpm_key_is_fixed_exempt_from_lockout_and_needs_its_authorization failed. ci-linux-native-success failed only because that job failed. Fix, inside the layers: when BEP_TPM_TCTI names a TPM with no resource manager (not device:/dev/tpmrm or tabrmd) and swtpm is on PATH, bep_keeps_its_tpm_keys_across_restarts starts its own swtpm on two free local ports, waits for tpm2_getcap to answer, and stops it on drop. A real TPM behind /dev/tpmrm0 is still used as named. It prints which TPM it ran against. Alternative fix, out of scope: a nextest test-group with max-threads = 1 for binary(/_tpm_integration$/) in .config/nextest.toml. Deferred (lane: tpm): cargo nextest run -p bep --run-ignored ignored-only bep_keeps_its_tpm_keys_across_restarts, and cargo nextest run -p bep --run-ignored ignored-only bep_without_a_tpm_or_keyring_refuses_start. This box has no swtpm and no tpm2-tools. Locally both TPM tests compile and return early with 'Skipped.'. I did not run the private-swtpm path, so the tpm lane must prove it. cargo clippy -p bep --all-targets is clean. |
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/bep/tests/linux_custody_tpm_integration.rs:340, minimal-arch[bot] crates/bep/tests/linux_custody_tpm_integration.rs:418. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The two new test files conform to gatehouse §6.10 line 837. They prove that bep keeps its keys in the TPM across restarts, and that it refuses to start when it has no key store. The change is test-only, in the bep crate, and pins the refusal text that keys.rs prints. The two TPM proofs are deferred, and the executor did not run them. A deferred leg is not a pass. C1 asks you to record the bep-tpm-integration CI result for this head in the PR body.
Ruled at a9c4cf4 against gominimal/arch@327e1b57d16b by claude-opus-5-5.
|
/revise Meet the arch review's three C1 conditions on this PR (threads at Evidence at head
Summary: The gap: nextest hides a passing test's stderr. So the log has no line in which each test names the TPM it used (for the restart proof, its own
|
…s-hold-the-proxy-s-keys-end-to-end
With BEP_TPM_TCTI set, a missing tpm2-tools now fails the test, so a pass in the bep-tpm-integration lane shows the test ran. Each test also prints the TPM it runs against.
|
Round 2 of 10 on a /revise note, pushed as
Verify Review threads the coder judged:
On a Linux host with a TPM, Notes from the agent: Revise round 2. I took the directive's second option. With BEP_TPM_TCTI set, tpm_lane() now panics when tpm2-tools is missing, and does not print Skipped. scripts/bep-tpm-integration.sh always exports BEP_TPM_TCTI before it calls nextest, so in the lane no TPM test can pass by an early return. Each test also eprintln!s its TPM: the restart proof names the TCTI it uses after tpm_for_restarts (its own swtpm when it starts one), and the refusal proof names the lane TPM and the NO_TPM TCTI it uses. I did not add --success-output immediate. The justfile and scripts/bep-tpm-integration.sh are outside this task's layers, so the stderr lines still show only on a failure, unless someone adds that flag. Item 2 of the directive (record the bep-tpm-integration run of the new head in the PR body's Deferred table) is not mine to do. I cannot edit the PR body, and the lane has not run on the new head yet. The runner or a person must add the run URL, each test's pass, and the TPM line after CI runs. Deferred (lane tpm): bep_keeps_its_tpm_keys_across_restarts and bep_without_a_tpm_or_keyring_refuses_start. I also ran the second one locally with no BEP_TPM_TCTI. It returned early as designed (exit 0, 1 passed), so that run is not evidence for the tpm lane. |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The TPM proofs conform to Gatehouse §6.10 line 837. The keys stay in the TPM across restarts and do not move to another store. With no usable store, bep refuses to start. The TPM lane now fails, not skips, when a TPM is asked for and the tools are missing. The Secret Service half of the T133 proof has no end-to-end test and no issue. File that issue and link it in the PR body as C1 says.
Ruled at a40f081 against gominimal/arch@327e1b57d16b by claude-opus-5-5.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 4 unresolved threads — minimal-arch[bot] crates/bep/tests/linux_custody_tpm_integration.rs:345, minimal-arch[bot] crates/bep/tests/linux_custody_tpm_integration.rs:424, minimal-arch[bot] crates/bep/tests/linux_custody_tpm_integration.rs:345, minimal-arch[bot] crates/bep/tests/linux_custody_tpm_integration.rs:1. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
|
/revise Meet arch ruling 1341's one remaining condition at The Secret Service half of T133's proof has no end-to-end test here: on a Linux host with no usable TPM, Add a While you edit the body, update its Deferred notes as well. The ruling found that |
|
Round 3 of 10 on a /revise note: the coder changed nothing. This round makes no code change, as the /revise note asks. The note asks for two pull request body edits. I have no credential to edit the body, so I give the text here for the runner or a person to add. Add to the body: Residuals
Deferred notes, replace with: I cannot give the run URL of…[truncated] |
bryan-minimal
left a comment
There was a problem hiding this comment.
Read the tests against keys.rs. They can fail for the right reasons: a restart that makes new keys changes the fingerprints, a key outside the TPM is caught, and losing the TPM must neither delete key files nor rewrite the published identity. The strings they look for are the real ones. They also ran: the TPM job in the Linux native lane passed both, none skipped.
Before merge:
- The arch thread is not answered yet. It asks for an issue covering the Secret Service half of the proof, linked under
## Residuals. The body has no such section and links no issue. - The body is out of date: it says the TPM tests were "written but not run". They ran in the TPM job.
Two small notes, neither blocking: the tests reach the TPM through wrapper scripts, so how bep itself picks the device is not exercised; and the helper that finds two free ports releases them before the software TPM binds them, which leaves a small window for a flake.
|
/review |
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 a40f081e0d60 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 a40f081e against T133's plan block and test lines. Approve.
-
start:
bep_on_linux_with_no_store_prints_the_refusalruns the realbepbinary with a cleared environment.PATHholds only asecret-toolthat reports no session bus, and notpm2-tools. The test asserts the exact BEP-088 refusal line, a non-zero exit, and that no identity file is published. -
e2e:
bep_keeps_its_tpm_keys_across_restartsasserts:- store
tpmfor each role, and.keyplus.authfiles for each role; - the same fingerprints and the same files on the second start, and no "chose the key store" line, so no key is generated twice;
- with the TPM removed, a kept-key refusal that names no
--replace-key, unchanged key files, and a byte-identical identity file.
bep_without_a_tpm_or_keyring_refuses_startasserts the refusal withtpm2-toolsinstalled and no TPM behind them. Both print the TPM they use. Sincea40f081eboth fail instead of skipping whenBEP_TPM_TCTIis set. Both ran and passed inbep-tpm-integrationon this head (run 43981178293: 3 passed, 0 skipped). - store
-
Round 1: gives the restart proof its own
swtpmwhen the lane's TCTI has no resource manager. That fixes theTPM_RC_OBJECT_MEMORY(0x902) failure inkey_store_tpm_integration, which the two binaries' whole-TPM flushes caused when they ran at the same time. -
Proof: the Secret Service half is not proven end to end here. It is deferred to gominimal/inbox#1269, as arch ruling 1341 asked, and linked under
## Residuals.
Non-blocking notes:
free_port_pairreleases both ports beforeswtpmbinds them, so another process can take one in between. The 30 s readiness loop would then report thatswtpmexited. This is a test-only race.- Without
swtpmonPATH,tpm_for_restartsfalls back to the shared TPM and says so. The arch ruling notes that CI always hasswtpm.
T133 — Linux hosts hold the proxy's keys, end to end
slice: S18
kind: integration
covers: none
size: L
est: 0 code, 700 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: each proof prints the TPM it ran against, and the
bepoutput of a start it expected to refuseobservability: on a failure the proof prints the
beplog lines with the store of each key, so a key generated in the wrong store or a second time shows wherelayers:
- e2e:
- crates/bep/tests/linux_custody_tpm_integration.rs (new): starts
beptwice against the TPM thatBEP_TPM_TCTInames and checks the published fingerprints match, removes the TPM and checks the next start refuses and keeps the key files, and with no TPM and no Secret Service checks the start refusestest (deferred: tpm): cargo nextest run -p bep --run-ignored ignored-only bep_keeps_its_tpm_keys_across_restarts
test (deferred: tpm): cargo nextest run -p bep --run-ignored ignored-only bep_without_a_tpm_or_keyring_refuses_start
- start:
- crates/bep/tests/linux_custody.rs (new): starts the
bepbinary on Linux with no TPM named and asecret-toolonPATHthat reports no session bus, and checks it prints the no-usable-TPM-and-no-keyring refusal and exits non-zerotest: cargo nextest run -p bep bep_on_linux_with_no_store_prints_the_refusal
produces: none
consumes:
- crates/bep/src/linux_store.rs
proof: On a Linux host with a TPM,
bepstarts and keeps its keys in the TPM across restarts. On a desktop with no TPM it keeps them in Secret Service, andmin auth statusnames each software key. A host with neither, or a key store it cannot read, refuses to start and says why.depends on:
- blocked by #3323
- blocked by #3324
- blocked by #3326
- blocked by #3325
- blocked by #3327
- blocked by #3328
Proof
On this branch, a person can run the bep binary on Linux with no TPM and a secret-tool that has no session bus. bep prints the line that says the host has no usable TPM and no unlocked Secret Service keyring, exits non-zero and publishes no identity. The tpm lane test starts bep twice against a real TPM and checks the same fingerprints with store tpm. It then removes the TPM and checks that the start refuses, keeps every key file and leaves the identity as it was. The Secret Service half of the proof (keys in Secret Service, and min auth status names each software key) has no test in this task. The unit tests in linux_store.rs and the earlier T132 work cover it, not an end-to-end run.
Notes from the agent: Deferred (lane: tpm), written but not run:
cargo nextest run -p bep --run-ignored ignored-only bep_keeps_its_tpm_keys_across_restartsandcargo nextest run -p bep --run-ignored ignored-only bep_without_a_tpm_or_keyring_refuses_start. I only confirmed withcargo nextest listthat both are listed. They return early when BEP_TPM_TCTI is not set. The bep binary does not read BEP_TPM_TCTI. It always uses device:/dev/tpmrm0 (TpmStore::at_home). So the e2e test does not change src. It puts a wrapper for each tpm2* command first on PATH. The wrapper runs the real tool with the TCTI from a state file. For a TCTI that is not device:/dev/tpmrm* or tabrmd, it also flushes transient, loaded and session handles, because swtpm has no resource manager. A test removes the TPM when it writes device:/nonexistent/tpmrm0 to that state file. If the tpm lane does not trust a wrapper, a later task can add a TCTI override to bep. On a failure, each test prints the TPM TCTI it ran against, the full bep stderr, and the bep log lines that carry store=. cargo clippy -p bep --all-targets and cargo fmt --check are clean.Tests
cargo nextest run -p bep bep_on_linux_with_no_store_prints_the_refusalVerify
min task run agent-verifypassed ([tasks.verify]).Deferred
The plan marked these test lines deferred: the executor lacks the lane, so nothing here ran them and they still owe evidence.
a40f081ecargo nextest run -p bep --run-ignored ignored-only bep_keeps_its_tpm_keys_across_restartscargo nextest run -p bep --run-ignored ignored-only bep_without_a_tpm_or_keyring_refuses_startbep_keeps_its_tpm_keys_across_restartsandbep_without_a_tpm_or_keyring_refuses_startrun in thebep-tpm-integrationlane throughscripts/bep-tpm-integration.sh. That script setsBEP_TPM_TCTI(it starts a swtpm when the variable is unset) and runscargo nextest run -p bep --run-ignored all -E 'binary(/_tpm_integration$/)'. Sincea40f081ea test fails, and does not skip, whenBEP_TPM_TCTIis set and the TPM cannot be reached. Ona40f081ethe lane printedTPM: swtpm:host=localhost,port=2321and3 tests run: 3 passed, 0 skipped(job).Residuals
bepkeeps its keys in Secret Service, andmin auth statusnames each software key. Filed as https://github.com/gominimal/inbox/issues/1269.Closes #3329