review: Astra brief for the store write credential code, round 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+107
−0
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-code.md+107 −0
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-code.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-code.md| new file mode 100644 |
| index 000000000..41222c916 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-store-write-credential-code.md |
| @@ -0,0 +1,107 @@ |
| +# Review brief: store write credential, code, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `store-write-credential`, at the commit named in |
| +your prompt. Under review: the diff `origin/main...HEAD` (main is merged in, |
| +so `git diff origin/main...HEAD` is this branch's own change). |
| +Authorities: the design on this branch, |
| +`docs/superpowers/specs/2026-11-25-store-write-credential-design.md` rev 4 |
| +(its own reviews: `docs/superpowers/reviews/REVIEW-FINDINGS-store-write-credential-design-R1.md` |
| +to `-R3.md`), and on main AGENTS.md, `internal/objstore`, `internal/release` |
| +(adopt.go, program.go: D2), `internal/console` and `infra/modules/region-host`. |
| + |
| +You are an independent reviewer. Read the design, then the code, and check |
| +every claim against the code. This is a security gate on production storage |
| +and it changes what an adopting box (root) will point live. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's rulings, 2026-11-25: option B (a per-store writer IAM user that |
| + never holds a lasting key; the app's key never gains STS); Service |
| + credentials may reach the doors; no refusal during a rotation; option A |
| + for the rollback P1 (a two-phase rollout enforced in code). No fourth |
| + design round: findings on the design itself go here, against the code. |
| +- Never call AWS or any network service. |
| + |
| +## What to check |
| + |
| +Review these three parts separately and say which part each finding is in. |
| + |
| +**A. The rollback fix (design §10), as its own change.** |
| + |
| +1. The phase gate: `writeCredentialsReleasedPhase` and `writeCredentialsPhase` |
| + in `internal/console/apistorecredentials.go`. Can a phase-1 console make a |
| + writer, a state object or the floor object by any route (both doors, the |
| + grant walk, anything else that calls `objstore.MintWriteCredentialIn`)? |
| +2. The console floor: `internal/release/consolefloor.go`, its call in |
| + `adoptHost` (`consoleFloorAdmits`, beside D3's `bindProof`), and the |
| + first-mint write in `objstore.claimRawMintWriteCredentialIn`. Does it make |
| + a rollback to a writer-unaware console impossible while a writer exists, |
| + by every adoption path (agent pass, root pass, unit-stamped routes, the |
| + root history mode)? Is the capability marker reliably in every console |
| + build from this one on (`cmd/console/writecredentials.go` |
| + `logConsoleCapabilities`, called from `storeBackend`), including a console |
| + with no store backend? Is the ordering (floor before state object before |
| + writer) right, and can a forged floor object do anything but refuse? |
| +3. Root safety of the gate: the new read of the floor object and the scan of |
| + the staged bytes, failure handling (a read error refuses for the pass), |
| + and that it cannot block a non-console route. |
| + |
| +**B. Round 3's P2s, against the code.** |
| + |
| +4. Design §2.3's lock discipline: check every caller of the code that writes |
| + the writer's policy (`claimRawConvergeWriterIn`, reached from the mint, the |
| + revoke and the grant walk) holds the locks the section says, and that |
| + write-then-validate behaves as stated on failure. |
| +5. Design §7: the boundary change and what each principal gains, including |
| + the multipart pair for existing app keys with `store_conversion` off; |
| + `infra/modules/region-host/tests/store_write_credentials.tftest.hcl`. |
| + |
| +**C. The rest of the change.** |
| + |
| +6. Scope: `writeSessionPolicy`, `writerPolicyJSON`, `ValidWritePrefix`. |
| + Anything that lets a write credential read, list, delete, tag, write |
| + outside its prefix, another store or a deployment bucket? |
| + `internal/objstore/writecred_policy_test.go`'s evaluator and cases: are |
| + they sound and sufficient? The 2,048-character test. |
| +7. The writer's lifecycle: creation (`EnsureWriter`, the boundary stamp), |
| + teardown (`claimRawTeardownIn`, both the shared-user and the normal path), |
| + and the app purge path that reaches teardown. |
| +8. The mint (`aws_writecred.go`): the reap of the writer's keys, the |
| + single-use key, the detached and bounded delete, the retry list, that no |
| + secret reaches a log, an error, the audit row or the record. |
| +9. Revocation and clocks: `revocationInstant`, the holdoff and the AWS |
| + issue-time check, and their tests. |
| +10. The doors and the CLI: gates and their order, error mapping, the |
| + `Cache-Control`, roles (`svcrole.Allow(svcrole.Service)`), linked |
| + accounts, host-claim consoles, the CLI's flags and output. |
| +11. The MinIO contract (`.amadan/ci.d/30-minio-contract`, |
| + `contract_writecred_test.go`) and `TestMinioFixtureTracksWriterPolicy`. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. (The |
| + census, and review of any newly changed security, root, termination |
| + or production-storage behaviour, still check the fix; see AGENTS.md, |
| + "Stopping rules".) |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the part (A, B or C), the problem, |
| +the evidence (file:line, verified), the failure scenario, a concrete fix |
| +and the invariant or trust boundary it breaks (that is its fault family). |
| +End with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |