carlos / platform Public

spec rev 5: Astra round 3 (no-mailer answer before limits, mailer readiness)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 69f792d6ff81b61dcfb5f1f74f15b5b34645f27b parent 0c1a28b
2 files changed, +52 −2
  • docs/superpowers/reviews/CODEX-FINDINGS-email-signin-r3.md +37 −0
  • docs/superpowers/specs/2026-10-21-console-email-signin-design.md +15 −2

CI passed — run details

diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-email-signin-r3.md b/docs/superpowers/reviews/CODEX-FINDINGS-email-signin-r3.md
new file mode 100644
index 000000000..465aa50e0
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-email-signin-r3.md
@@ -0,0 +1,37 @@
+| Prior finding | Disposition | Rev-4 assessment |
+|---|---|---|
+| R1-1: Login CSRF | fixed | §5.1 requires a confirmation nonce and origin checks; §11 retires legacy confirmation. |
+| R1-2: Unlimited guessing budgets | fixed | §5 bounds guesses across challenges and creates no redeemable challenge for refused requests. |
+| R1-3: Pending-action hash mismatch | fixed | §6 specifies redemption by hash with session binding, expiry and single-use checks. |
+| R1-4: SMTP fallback to Keymail | fixed | §§4 and 11 specify discovery and the settled B4 fallback policy for invites and notices. |
+| R1-5: First CLI step-up email suppressed | fixed | Email sign-in records fresh authentication; step-up has separate send limits. |
+| R1-6: Challenge outlives pending action | fixed | §6 aligns step-up challenges with the pending action’s ten-minute lifetime. |
+| R1-7: Recipient validation | fixed | §11 requires a normalized, strictly parsed bare address throughout. |
+| R1-8: `next` bypasses onboarding | fixed | §8 requires account selection or creation before following `next`. |
+| R1-9: Existing SES identity ownership | fixed | §9 requires the adoption check and ownership TXT record. |
+| R2-1: Offline code recovery | fixed | §5 authenticates code digests with a key held outside the database. |
+| R2-2: Cross-browser link invalidation | fixed | §5 preserves other challenges’ links when the shared guessing limit is exhausted. |
+
+Reviewed spec rev 4 at `0c1a28ba`. These dispositions concern the design, not completed implementation. **No new P1 findings; two new P2 findings.**
+
+1. **P2 — The unavailable-mailer response exposes rate limiting.**
+
+ **Spec:** [§4.2](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/email-signin/docs/superpowers/specs/2026-10-21-console-email-signin-design.md:128), §7 and §3’s anti-oracle requirement.
+
+ **Evidence:** A disabled mailer is an ordinary supported state: [cmd/console/main.go:1024](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/email-signin/cmd/console/main.go:1024) returns `nil` under claim mode; missing mail configuration also returns `nil`.
+
+ **Failure:** §4.2 explicitly gives an email-bound request an unavailable-mailer response, but gives a rate-limited request the normal “check your email” page. With mail disabled, submitting the same address before and after the 30-submissions IP cap produces distinguishable responses. This reveals throttling, contrary to §3, and tells the throttled person to expect mail from a console that cannot send it.
+
+ **Fix:** Make the unavailable-mailer response independent of throttling. Enforce request limits internally while rendering the same unavailable response for both cases.
+
+2. **P2 — The unverified-mailer refusal lacks a readiness mechanism.**
+
+ **Spec:** §4.2 requires an immediate refusal when the sending identity is unverified, while moving delivery into a background goroutine.
+
+ **Evidence:** [consolemail.go:33](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/email-signin/internal/console/consolemail.go:33) exposes only `Send`. The constructor returns a non-nil mailer before verification; its startup `Ensure` provisions the identity but does not establish readiness. Verification occurs inside private `ready`, called by [Send at consolemail.go:166](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/email-signin/internal/console/consolemail.go:166).
+
+ **Failure:** With configuration present but DKIM verification pending, a nil check passes. Following the specified background-send sequence renders “check your email” before `Send` returns `ErrConsoleMailNotReady`. The required refusal cannot be implemented through the existing interface, and the spec supplies no replacement readiness mechanism.
+
+ **Fix:** Specify a readiness API or maintained readiness state, including refresh while verification is pending. Check it before creating the challenge and choosing the response; keep delivery asynchronous.
+
+No files were edited. No test suites were run.
\ No newline at end of file
diff --git a/docs/superpowers/specs/2026-10-21-console-email-signin-design.md b/docs/superpowers/specs/2026-10-21-console-email-signin-design.md
index 978d14bd2..6abcb8ae5 100644
--- a/docs/superpowers/specs/2026-10-21-console-email-signin-design.md
+++ b/docs/superpowers/specs/2026-10-21-console-email-signin-design.md
@@ -1,6 +1,6 @@
# Console email sign-in (magic links), with Keymail found from the address
-Status: draft rev 4, 2026-10-21 (rev 3 + R5: one door, Keymail discovered from the address; §15). Follows
+Status: draft rev 5, 2026-10-21 (R5: one door, Keymail discovered from the address; Astra rounds 1-3; §15). Follows
[console invite delivery](2026-09-28-console-invite-delivery-design.md),
whose §4 console mailer this reuses and whose line 4 named this spec.
@@ -129,7 +129,16 @@ address (anti-goal); discovery has already routed those to Keymail.
page says so plainly for an email-bound address ("this console can't
send email yet") instead of pretending a message is on its way. This
reveals only that the address is not a Keymail mailbox, which is public.
-A rate-limited request still gets the normal page.
+This answer is decided **before** any rate limit and is the same whether
+or not the request was throttled, so throttling stays invisible (codex
+r3-1). With a working mailer, a rate-limited request gets the normal
+"check your email" page.
+
+**Readiness** (codex r3-2). `ConsoleMailer` gains `Ready(ctx) bool`: the
+existing private `ready` (verified answers cached for the process, a
+not-verified answer rechecked after `consoleMailPendingRecheck`) behind a
+short context (2 s; a timeout reads as not ready). `/auth/continue` asks
+it before creating a challenge. A nil mailer is not ready.
**Sends run off the request.** The handler records the challenge, starts
the send on a background goroutine with its own bounded context (20 s),
@@ -504,3 +513,7 @@ from the address picks Keymail OAuth or email. Consequences: sign-in and
step-up messages go by SES only (§4.2); the Apps-inbox confirmation link
is retired (§11); B1's channel-based method is gone; invites and notices
keep the B4 two-channel rule (§4.3).
+
+Astra round 3 (`CODEX-FINDINGS-email-signin-r3.md`): all eleven earlier
+fixes confirmed, no P1. Both P2s accepted: r3-1 the no-mailer answer is
+decided before rate limits (§4.2); r3-2 `ConsoleMailer.Ready` (§4.2).