carlos / platform Public

Fleet secrets key design rev 5: Astra round 3 (direct mode refuses any registered fleet key via the bucket owner records; guard over seal calls and sealer construction; refusal join covers platform boxes and capped reports)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev e2b0c5da23d3f642e2dc36694e2cc5c361222f84 parent f019514
2 files changed, +73 −12
  • docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md +47 −12
  • docs/superpowers/specs/CODEX-FINDINGS-fleet-secrets-key-R3.md +26 −0

CI passed — run details

Intent

Human

<task-notification> <task-id>bryef9386</task-id> <tool-use-id>toolu_01LPXicFEXuvUx3DmoNVLyHw</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/2d812478-ae68-44f2-8075-b2330abd5939/tasks/bryef9386.output</output-file> <status>completed</status> <summary>Background command "Run Astra round 3 review" completed (exit code 0)</summary> </task-notification>

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 37905885e..1ef6f379e 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). 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
+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). Rev 5: Astra round 3 (`-R3.md`): direct mode's key check (P1), the guard test and the §5.7 join (P2). Discussion: amadan carlos/platform #366
(found by rootfs Plan 4 Task 11). Branch `design-fleet-secrets-key`.
## 1. Why
@@ -177,8 +177,12 @@ change.
box cannot render an app placed on fleet A) is part of the plan.
- Storage: three columns on the registry `fleets` table,
`secrets_pubkey`, `secrets_key_fp`, `secrets_key_set_at` (plus who set
- it, as the other fleet writes record). Builder's call whether it also
- goes on the bucket `FleetOwner` record; nothing on a box needs it.
+ it, as the other fleet writes record). (R3 #1) Registration also
+ writes the key's fingerprint onto the fleet's bucket owner record
+ (`release.FleetOwner` gains `secrets_key_fp`), creating the record if it
+ is missing, BEFORE the registry row commits; a failed bucket write fails
+ the registration. So every registered fleet key is listed in the bucket,
+ which is what direct mode checks (§5.3). Nothing on a box reads it.
- Shown: `carlos fleets ls` gains the key's short fingerprint per fleet
(`-` when none), and the fleet's console page shows it. The BYO page's
host.env block gains the `CARLOS_SECRETS_KEY=` line with one sentence
@@ -236,11 +240,23 @@ app with the one key and must take each app's key in turn. On a keyless
fleet the config GET omits `secrets_pubkey` rather than refusing, because
the same GET serves `env` and `secrets list` (`apiconfig.go:240-276`); the
CLI's existing "no key here" path then refuses `secrets set` and the
-console's PUT names the fix (B8). A guard
-test (go/ast, like the rootfs Plan 2 guard) fails if any file in
-`internal/console` other than the one holding `sealKeyFor` reads
-`cfg.SecretsPub` to seal; `expectedSecretsFP` stays for the platform
-regions' box checks. Background walks (store, mail, plan storage, scan
+console's PUT names the fix (B8).
+
+(R3 #2) The guard test is over sealing calls, not field reads. A go/ast
+test over the whole module lists every call to `appconfig.Seal`,
+`appconfig.SealBound` (or whatever the sealer's constructor and seal
+methods are named once built) and every construction of the sealer type,
+and fails on any call site not in a small allowlist of named functions:
+`sealKeyFor` itself, the CLI's two sealing paths (API mode seals to the
+console's answer; direct mode after §5.3's check), and the package sealers
+(`objstore`, `mail`) that take a sealer as an argument and never build
+one. Inside `internal/console` the only constructor of a sealer is
+`sealKeyFor`. Negative fixtures prove it bites: a new seal site handed an
+arbitrary public key, a second seal site added in `sealKeyFor`'s own file,
+and a sealer for account A used on account B's app (a runtime check in the
+sealer: it carries the account and app it was chosen for and refuses any
+other binding). `expectedSecretsFP` stays for the platform regions' box
+checks. Background walks (store, mail, plan storage, scan
callback) call it per app, so an app placed on a keyless fleet is skipped
with a log line and retried on the next pass, never sealed to the
deployment key as a fallback.
@@ -312,7 +328,17 @@ plan; they test the lock, not I1.
(`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
+ `fleetowner.go:135`). (R3 #1) Direct mode seals to whatever
+ `CARLOS_SECRETS_PUBKEY` the terminal holds (`appconfig_cli.go:827`), so
+ I1 needs one more check there, and it is authoritative: before sealing,
+ direct mode lists every account's fleet owner records
+ (`accounts/*/fleets/*.json`) and refuses if the terminal key's
+ fingerprint matches any `secrets_key_fp` among them, or if the listing
+ fails. Every registered fleet key is in that listing (§5.1), so a direct
+ write can only seal to a key no fleet holds through the platform, in
+ practice the deployment key. A witness puts account B's fleet key in the
+ terminal and targets account A. A miss of the owner-record check above
+ then 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`
@@ -379,9 +405,16 @@ 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.
+credential the console minted). Console and CLI only.
+
+(R3 #3) The join covers platform boxes' snapshots too (an I2 miss can
+leave a fleet-key value on a platform instance), not only fleet boxes'.
+A box publishes at most 100 refusals with their total beside them
+(`configguard.go:50`, `:335`). When a snapshot's total exceeds its list,
+every instance on that box without a listed refusal shows the REASON
+"this box refused more instances than it reports; check its journal for
+config guard lines" rather than nothing. Witnesses: a platform instance
+holding a fleet-key value, and a box with more than 100 refusals.
## 6. Boxes
@@ -469,3 +502,5 @@ store backend (approved by Paul, 2026-10-29) is configured beside it.
today.
- C12. (R2 #3) A local `carlos secrets fingerprint` instead of a box
change to publish fleet boxes' key fingerprints.
+- C13. (R3 #1) Registered fleet key fingerprints go on the bucket owner
+ record so direct mode can refuse them.
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-fleet-secrets-key-R3.md b/docs/superpowers/specs/CODEX-FINDINGS-fleet-secrets-key-R3.md
new file mode 100644
index 000000000..ebf58a505
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-fleet-secrets-key-R3.md
@@ -0,0 +1,26 @@
+- R1/A1 (P1): **Resolved by the §2.1 cut** — deployment-key fallback is an accepted I2 miss.
+- R1/A2 (P1): **Resolved** — `sealKeyFor` resolves the canonical account and requires an app row.
+- R1/A3 (P1): **Resolved** — an atomic unique index prevents simultaneous registration of the same fingerprint on different fleets.
+- R1/A4 (P1): **Resolved by the §2.1 cut** — serialization serves best-effort I2.
+- R1/A5 (P2): **Resolved** — the route includes `{account}` and explicitly requires owner authority.
+- R1/A6 (P2): **Resolved** — rollout includes the updated CLI, key installation and agent restart.
+- R2/#1 (P1): **Resolved by the §2.1 cut** — missing owner records can permit the accepted deployment-key fallback.
+- R2/#2 (P1): **Resolved** — `env fork` holds the account lock from source read through destination commit; remaining copy races are accepted under §2.1.
+- R2/#3 (P2): **Resolved** — the remedy includes fingerprint comparison, correcting the installed key and restarting the agent.
+
+1. **P1 — §5.3: direct mode can seal to another account’s fleet key.**
+ **Invariant: I1 — recipient keys belong to the target account or the platform.** The assertion that a direct-mode miss seals to the deployment key is unsupported: `secretsPubKey()` accepts any parseable `CARLOS_SECRETS_PUBKEY`. An operator with account B’s fleet public key left in the environment can write account A’s secret directly when A has no fleet owner records. The write succeeds, and B’s private key opens the envelope using A’s binding. This crosses the account boundary; it is not the accepted I2 deployment-key fallback.
+ **Evidence:** [design:311](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md:311), [appconfig_cli.go:827](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/appconfig_cli.go:827), [appconfig_cli.go:988](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/appconfig_cli.go:988), [crypto.go:245](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/appconfig/crypto.go:245).
+ **Fix:** require authoritative evidence that the selected key is the deployment key or belongs to A; refuse direct sealing when that evidence is unavailable. Add a witness with B’s key in the environment and A as the write target.
+
+2. **P2 — §5.2: the guard test does not enforce the claimed sealing boundary.**
+ **Invariant: I1 — every seal uses authorized key selection.** The specified test detects reads of `cfg.SecretsPub` outside one exempt file. A new seal site using a fleet key or a public-key argument reads no such field and passes. A bypass added inside the exempt file also passes. Existing sealing already occurs through public-key arguments and outside `internal/console`.
+ **Evidence:** [design:239](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md:239), [design:251](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md:251), [scankeysync.go:37](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/console/scankeysync.go:37).
+ **Fix:** specify a guard over sealing calls and sealer construction, with function-level exceptions and coverage of delegated package sealers. Require negative fixtures for an arbitrary fleet-key argument, a new seal site in the helper’s file, and a sealer used for another account.
+
+3. **P2 — §5.7: the proposed join cannot show every accepted I2 miss.**
+ **Invariant: I2 recovery — a missed mismatch produces visible diagnostic guidance.** Platform-box joins are optional, although accepted copy/import paths can leave fleet-key envelopes on platform instances. Fleet reports also contain at most 100 refusal entries: with more refusals, joining only the listed hosts leaves some refused instances without a REASON. The total count exposes truncation, but the design specifies no handling for it.
+ **Evidence:** [design:86](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md:86), [design:375](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/docs/superpowers/specs/2026-10-29-fleet-secrets-key-design.md:375), [configguard.go:50](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/host/configguard.go:50), [configguard.go:335](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-secrets-key/internal/host/configguard.go:335).
+ **Fix:** require platform joins and explicit handling of truncated reports. A missing entry in an incomplete report must produce an incomplete-diagnostics REASON with recovery guidance, rather than imply success. Include platform mismatch and more-than-100-refusal witnesses.
+
+NOT READY
\ No newline at end of file