Fleet secrets key design rev 4: Paul's stopping-rule-2 cut (I1 confidentiality hard, I2 availability best effort), env fork under the lock, carlos secrets fingerprint for the cannot_open remedy; round 3 brief
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md+66 −20docs/superpowers/specs/CODEX-FINDINGS-fleet-secrets-key-R2.md+20 −0docs/superpowers/specs/CODEX-REVIEW-BRIEF-fleet-secrets-key-R3.md+32 −0
CI failed — run details
Intent
<task-notification> <task-id>ba4tx1u4q</task-id> <tool-use-id>toolu_01C9gN7DVXFUaEjMgZ8dNjbB</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/2d812478-ae68-44f2-8075-b2330abd5939/tasks/ba4tx1u4q.output</output-file> <status>completed</status> <summary>Background command "Run Astra round 2 review" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>b65pcont1</task-id> <tool-use-id>toolu_01PwxtcwX1jJBcQbz1Kc4pGr</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/2d812478-ae68-44f2-8075-b2330abd5939/tasks/b65pcont1.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra round 2 marker" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 18.3 g CO₂e (2,088,995 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-fleet-secrets-key, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md b/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md| index e49b389dd..37905885e 100644 |
| --- a/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md |
| +++ b/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md |
| @@ -1,6 +1,6 @@ |
| # Fleet secrets key: secrets for apps on a customer's own boxes |
| -Status: draft rev 3, 2026-10-29. Rev 2: the builder check (B1-B9). Rev 3: Astra round 1 (A1-A6, `CODEX-FINDINGS-fleet-secrets-key-R1.md`, all accepted). Discussion: amadan carlos/platform #366 |
| +Status: draft rev 3, 2026-10-29. Rev 2: the builder check (B1-B9). Rev 3: Astra round 1 (A1-A6, `CODEX-FINDINGS-fleet-secrets-key-R1.md`, all accepted). Rev 4: Astra round 2 (`-R2.md`) tripped stopping rule 2 in A1's and A4's families; Paul's cut (2026-10-29): split the invariant (§2.1). Discussion: amadan carlos/platform #366 |
| (found by rootfs Plan 4 Task 11). Branch `design-fleet-secrets-key`. |
| ## 1. Why |
| @@ -36,13 +36,14 @@ Goals: |
| fleet's key: `carlos secrets set` values, and every credential the |
| console mints and seals (store, mail, relay, scan callback, plan-storage |
| deny). |
| -- G3. Nothing sealed for a fleet-placed app is ever sealed to the |
| - deployment key, and nothing for any other app is ever sealed to a fleet |
| - key. Enforced in one place, checked by a guard test. |
| +- G3. The confidentiality invariant I1 (§2.1) holds on every path and |
| + under every race. Enforced in one place, checked by a guard test. |
| - G4. The owner can see, per fleet, whether a key is registered, and per |
| instance, when a box refused its config and why (B1, B6). |
| -- G5. A mismatch is refused when it is written, not found when an instance |
| - starts. |
| +- G5. A value sealed to a key the app's boxes do not hold is refused when |
| + it is written wherever the console can see it (I2, best effort), and |
| + whatever slips past is refused by the box and shown with its fix |
| + (§5.7). |
| Non-goals (v1): |
| - Key rotation with both keys live. v1 allows replacing a fleet's key only |
| @@ -60,6 +61,34 @@ Anti-goals (a failure even if it works): |
| - A secret silently missing at start: the box guard stays the last line, |
| never the first. |
| +### 2.1 Two invariants, one hard (Paul, 2026-10-29) |
| + |
| +Astra rounds 1 and 2 found two fault families: a writer that cannot know |
| +an app's placement (direct-bucket mode, A1 and round 2 #1), and copy or |
| +write paths racing a key or placement change (A4 and round 2 #2). Neither |
| +family exposes a secret; each can only leave a value sealed to a key the |
| +app's boxes do not hold. Paul's cut under stopping rule 2: |
| + |
| +- **I1, confidentiality (hard).** A value sealed for app X of account A |
| + opens only on platform boxes (the deployment key, held by the operator |
| + as today) or on boxes of a fleet owned by A. It holds on every path and |
| + under every race because the only keys anything can seal to are the |
| + deployment key and keys from `sealKeyFor`, which returns either the |
| + deployment key or the key of a fleet whose owner is A (§5.2), and fleet |
| + keys are unique (§5.1). Enforced in `sealKeyFor`, the unique index and |
| + the guard test; no other mechanism is relied on for it. Within one |
| + account, a fleet's boxes can open values sealed to that fleet's key for |
| + any of A's apps (the store door reads the whole account, A3); that is the |
| + same customer and accepted. |
| +- **I2, availability (best effort).** A value for X should be sealed to |
| + the key X's boxes hold. The console refuses a mismatch at write time |
| + where it can see one (§5.3, §5.5, §5.6, the lock of §5.2.1). It is not |
| + a guarantee: direct-bucket mode, copy paths (`env fork`, adopt, |
| + imports) and races may still leave a mismatched value. The box's config |
| + guard refuses such an instance, and §5.7 shows the refusal on `carlos |
| + instances list` with the fix. No further mechanism is added for I2 in |
| + v1, and reviews do not reopen it. |
| + |
| ## 3. What exists (main 0c39af30) |
| - Fleet enrollment is by hand. `fleets create` writes a registry `Fleet` |
| @@ -164,6 +193,11 @@ change. |
| its config is shown instead through §5.7. A positive per-box fingerprint |
| (in the fleet box's status snapshot) is a follow-up for the next box |
| change. |
| +- (R2 #3) `carlos secrets fingerprint [--file <host.env or key file>]`, |
| + a local command (no console), prints the fingerprint of the |
| + `CARLOS_SECRETS_KEY` it reads (default: `/etc/carlos/host.env`), so an |
| + owner can check on a box that it holds the fleet's registered key. It |
| + never prints the key. |
| - (B2, my call) Registering the FIRST key does not refuse, but its answer |
| lists every app placed on the fleet that has sealed values not sealed to |
| the new key (no `sealed_to`, or another one), with the fix: set those |
| @@ -225,8 +259,10 @@ that sealer instead of a bare public key; they also fill `sealed_to`. |
| A PUT that chose key A must not commit after a replacement installed key |
| B, and a placement change must not slip between a seal and its write. |
| -Every operation below runs under one console lock keyed by the account |
| -sqid, held from `sealKeyFor` through the commit of the write: |
| +This lock serves I2 only (§2.1); I1 does not depend on it. Every |
| +operation below runs under one console lock keyed by the account sqid, |
| +held from `sealKeyFor` (or, for a copy, the source read) through the |
| +commit of the write: |
| - the config PUT (`apiconfig.go:483`, `Apply` / `ApplyEnvironment`) for |
| any request carrying a sealed value; |
| @@ -235,7 +271,10 @@ sqid, held from `sealKeyFor` through the commit of the write: |
| - key registration and replacement (§5.1, §5.6), including their "no |
| sealed values" check; |
| - placement changes (`placeAppTarget`, `apps create --place` onto an |
| - existing app), including §5.5's check. |
| + existing app), including §5.5's check; |
| +- `env fork` (`apienv.go:301`, `owned.go:229`), which copies envelopes |
| + without sealing, because it is one handler and cheap to cover. Other |
| + copy paths are left to the box guard and §5.7 (I2). |
| The check that refuses (replacement while sealed values exist, a move |
| with stale values) reads the config under the same lock, so it sees every |
| @@ -245,8 +284,9 @@ straight through while host claims are off. |
| Assumption, stated so it can be checked: the console is one writer |
| process per deployment (one `console.db`). A deployment that ever runs two |
| console writers needs this lock moved into a shared fence first; the plan |
| -records where the assumption is made. Deterministic witnesses for both |
| -races (PUT vs replacement, PUT vs placement change) are part of the plan. |
| +records where the assumption is made. Deterministic witnesses for the |
| +PUT-vs-replacement race and the fork-vs-replacement race are part of the |
| +plan; they test the lock, not I1. |
| ### 5.3 What the CLI sends, and what the console refuses |
| @@ -267,13 +307,14 @@ races (PUT vs replacement, PUT vs placement change) are part of the plan. |
| with bucket access, no console) never meets the PUT, and it cannot know |
| an app's placement: the placement column lives in the console's |
| database, and a laptop has no registry at all (`appconfig_cli.go:59`). |
| - So it needs evidence it can read from the bucket: direct-mode `secrets |
| - set` refuses for any account that owns a fleet (any |
| - `accounts/<acct>/fleets/*.json` owner record exists), and says to use |
| - the console. An account with no fleet cannot have a fleet-placed app, |
| - so the deployment key is right for it. A read error refuses too. G3's |
| - single point of enforcement is the console; this refusal is the one |
| - other writer's guard, and it fails closed. |
| + So it uses the evidence it can read from the bucket: direct-mode |
| + `secrets set` refuses for any account that has a fleet owner record |
| + (`accounts/<acct>/fleets/*.json`), and says to use the console; a read |
| + error refuses too. This is best effort for I2 (round 2 #1: the owner |
| + record can be missing for a fleet that exists, `fleets.go:211`, |
| + `fleetowner.go:135`). A miss seals to the deployment key, which only |
| + platform boxes and the operator running direct mode hold, so I1 holds; |
| + the fleet box refuses the instance and §5.7 shows it. |
| - (B9) `scanSecretHash` hashes the whole `Var` |
| (`internal/console/scankeysync.go:16-23`), so adding `SealedTo` changes |
| what it covers: the plan keeps the hash's input as it is today (or |
| @@ -334,8 +375,11 @@ the console already loads for the fleet page (`fleets.go:1186`). In scope: |
| a console join of those refusals into the instance rows (under the same |
| tenant check as the rollout join), and a REASON cell naming the reason and |
| the fix (`no_key`: put the fleet's key in the box's host.env and restart the |
| -agent; |
| -`cannot_open`: set the secrets again). Console and CLI only. Platform |
| +agent; `cannot_open`: first check the box's key matches the fleet's |
| +registered fingerprint (`carlos secrets fingerprint` on the box against |
| +`carlos fleets ls`), and fix the key and restart the |
| +agent if not; otherwise set the listed secrets again, and rotate any |
| +credential the console minted). Console and CLI only. Platform |
| boxes' snapshots get the same join if it costs nothing extra; the builder |
| says which. |
| @@ -423,3 +467,5 @@ store backend (approved by Paul, 2026-10-29) is configured beside it. |
| - C10. (A4) One in-process lock per account, assuming one console writer. |
| - C11. (A5) Key registration is owner-only, stricter than `add-box` |
| today. |
| +- C12. (R2 #3) A local `carlos secrets fingerprint` instead of a box |
| + change to publish fleet boxes' key fingerprints. |
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-fleet-secrets-key-R2.md b/docs/superpowers/specs/CODEX-FINDINGS-fleet-secrets-key-R2.md| new file mode 100644 |
| index 000000000..dce719014 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-FINDINGS-fleet-secrets-key-R2.md |
| @@ -0,0 +1,20 @@ |
| +- R1/A1 (P1): **Partly resolved** — bucket owner-record absence still cannot establish platform placement. |
| +- R1/A2 (P1): **Resolved** — canonical account resolution and authoritative placement are specified. |
| +- R1/A3 (P1): **Resolved** — fleet-key uniqueness is enforced atomically. |
| +- R1/A4 (P1): **Partly resolved** — the serialization contract omits copying existing envelopes. |
| +- R1/A5 (P2): **Resolved** — the route includes the account and explicitly requires owner authority. |
| +- R1/A6 (P2): **Resolved** — rollout includes the CLI update and agent restart. |
| + |
| +1. **P1 — §5.3: absence of owner records still permits deployment-key fallback.** |
| + **Invariant:** fleet secrets never fall back to the deployment key. The proposed guard treats an empty bucket listing as proof that the account owns no fleet. But fleet creation commits the registry row before writing its owner record; a failed owner-record write leaves that row usable ([fleets.go:211](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/console/fleets.go:211)). Historical fleets’ backfill runs asynchronously and only logs failures ([fleetowner.go:135](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/console/fleetowner.go:135)). Placement checks registry ownership, without requiring that record ([fleets.go:662](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/console/fleets.go:662)). Consequently, a successful empty listing can admit direct sealing to the deployment key for a fleet-placed app. |
| + **Fix:** this repeats A1’s fault family, triggering stopping rule 2. Choose an upfront direct-write refusal, removal of direct sealing, or authoritative placement enforcement shared with fleet creation and tested across failures and races. Recommend refusing direct `secrets set` until affirmative placement evidence exists. |
| + |
| +2. **P1 — §§5.2.1, 5.6: `env fork` can restore an old-key secret after replacement succeeds.** |
| + **Invariant:** every committed sealed value matches the committed key and placement. The lock contract covers config PUT and seal sites, but `env fork` copies envelopes without sealing. Its handler holds only the app lock ([apienv.go:301](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/console/apienv.go:301)); the implementation reads the source, then creates a separate destination without checking the source again ([owned.go:229](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/appconfig/owned.go:229)). A fork can read a key-A secret, pause while the owner unsets it and replaces A with B, then successfully write the captured envelope into the destination. Replacement and fork both succeed, leaving undecryptable config. |
| + **Fix:** this repeats A4’s fault family, triggering stopping rule 2. Choose refusal of forks carrying secrets, removal of key replacement, or one shared validation and serialization boundary covering both sealing and copying. Recommend the shared boundary, held before the source read through destination commit, with a deterministic fork/unset/replacement witness. |
| + |
| +3. **P2 — §5.7: the `cannot_open` remedy cannot repair a box holding the wrong private key.** |
| + **Invariant:** a reported refusal provides an effective recovery procedure. The specified remedy is only “set the secrets again” ([design:338](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md:338)). However, a parseable but incorrect box key produces `cannot_open` when rendering fails ([canprovide.go:127](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/appconfig/canprovide.go:127)). Re-setting secrets seals them to the same registered public key and leaves that box unable to decrypt them. |
| + **Fix:** include checking that the installed private key matches the fleet’s registered fingerprint, correcting it and restarting the agent; reserve re-setting secrets for stale or incorrectly sealed values. |
| + |
| +NOT READY |
| \ No newline at end of file |
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-fleet-secrets-key-R3.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-fleet-secrets-key-R3.md| new file mode 100644 |
| index 000000000..f931f7d22 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-fleet-secrets-key-R3.md |
| @@ -0,0 +1,32 @@ |
| +# Review brief: fleet secrets key design, round 3 of 3 (LAST) |
| + |
| +Repo carlos/platform, branch `design-fleet-secrets-key`, commit named in your prompt. |
| +Under review: `docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md` (rev 4). |
| +Authorities: the code on this branch (main 0c39af30 plus the spec), `AGENTS.md`, and the merged rootfs spec `docs/superpowers/specs/2026-10-24-rootfs-apps-design.md`. Do not review against unmerged branches. Do not edit files. |
| + |
| +You are an independent reviewer. This is the last round allowed (AGENTS.md "Stopping rules"). Round 2 tripped stopping rule 2 in two fault families, and Paul made the cut that rev 4 records in §2.1. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's ruling (2026-10-29, #366): a per-fleet key, private half only on the fleet's boxes, public half on the fleet record. |
| +- Paul's stopping-rule-2 cut (2026-10-29, §2.1): **I1 confidentiality is the hard invariant; I2 availability is best effort.** A path that can leave a value sealed to a key the app's boxes do not hold, without breaking I1, is NOT a finding unless §5.7 fails to show it with a working fix. Do not raise further direct-mode, copy-path or race findings against I2. |
| +- The calls in §10. Challenge one only with an I1 failure it causes. |
| + |
| +## What to check |
| + |
| +1. Round 1 and round 2 dispositions: one line per P1 and P2 from `CODEX-FINDINGS-fleet-secrets-key-R1.md` and `-R2.md`: resolved (including "resolved by the §2.1 cut"), partly, or not. |
| +2. **I1 only, hard:** is there any path (console seal sites, background walks, team credentials, relay, scan, plan storage, `rotateWebhookBudget`, offline moves, the CLI in either mode, fleet registration) by which a value for app X of account A can be sealed to a key held by a box outside A's fleets and platform boxes? Is `sealKeyFor` plus the unique index plus the guard test really sufficient, and is the guard test specified tightly enough to catch a new seal site? |
| +3. §5.7 and the new `carlos secrets fingerprint`: does every I2 miss end in a visible REASON with a fix that works? |
| +4. Anything else that would make the design not work (P1 by the severity rules). |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe (an I1 break), would not compile, a test fails, or it would not work. Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. |
| +- **P3**: clarity or polish. Follow-up list. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Name the invariant beside each finding. Do not raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Dispositions first, then findings ranked P1, P2, P3, each with section, problem, evidence (file:line) and fix. Then one verdict line: READY, READY AFTER FIXES (no P1), or NOT READY (one or more P1). A P1 here goes to Paul; there is no round 4 without his go. |