spec: social sign-in rev 2 from the builder check
Google has no forced re-login, so all providers step up by email; Keymail holders always step up with Keymail; removal, operators, new-person budget.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/2026-11-02-console-social-signin-design.md+101 −34
Intent
<task-notification> <task-id>blu238m07</task-id> <tool-use-id>toolu_01HQn7mxt4ENZJDocKeC1B4n</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1730ddc5-7bb6-4ebb-ab9b-85efe2e437e3/tasks/blu238m07.output</output-file> <status>failed</status> <summary>Background command "Run Astra builder check on the design" failed with exit code 127</summary> </task-notification>
<task-notification> <task-id>b6gppt3hm</task-id> <tool-use-id>toolu_01E7K9KGqniFBdSQq7ozLc2c</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1730ddc5-7bb6-4ebb-ab9b-85efe2e437e3/tasks/b6gppt3hm.output</output-file> <status>completed</status> <summary>Background command "Rerun Astra builder check with absolute paths" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 7.60 g CO₂e (733,136 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-console-social-signin, 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-11-02-console-social-signin-design.md b/docs/superpowers/specs/2026-11-02-console-social-signin-design.md| index 1ef1bebad..c8fee2463 100644 |
| --- a/docs/superpowers/specs/2026-11-02-console-social-signin-design.md |
| +++ b/docs/superpowers/specs/2026-11-02-console-social-signin-design.md |
| @@ -1,6 +1,7 @@ |
| # Console sign-in with Apple, Google and GitHub, with linked sign-in methods and merging |
| -Status: rev 1, 2026-11-02, draft for Paul's approval. Follows |
| +Status: rev 2, 2026-11-02, draft for Paul's approval (rev 1 plus the |
| +builder check's answers, §14). Follows |
| [console email sign-in](2026-10-21-console-email-signin-design.md), whose |
| sign-in flow, sessions and step-up this extends. |
| @@ -45,8 +46,10 @@ Success: |
| does today. (§6.2 narrows how far a provider's word on an address is |
| trusted.) |
| - **P6. Re-confirmation uses the same provider where the provider can do a |
| - fresh login** (Google can). Where it can't (GitHub, Apple), it falls back to |
| - an emailed code. |
| + fresh login, and an emailed code where it can't.** None of the three can: |
| + Google doesn't support forced re-authentication for other sites, and |
| + neither do GitHub or Apple. So all three step up by emailed code (§8), |
| + unless the person holds a Keymail method (§8). |
| - **P7. People can merge two console identities into one**, as on Eleven, so |
| Hide My Email and similar cases don't strand anyone. Merging needs a fresh |
| confirmation of both sides. The person chooses which address stays as the |
| @@ -89,9 +92,11 @@ Anti-goals (a failure even if it works): |
| home page has this bug. Here, the console only offers what it has. |
| - **A provider becoming a way into someone else's person.** A provider's |
| claim about an email address must never attach to a person unless that |
| - provider is trusted for that address (§6.2). Linking a provider to an |
| - existing person, and merging, always need a fresh confirmation of the |
| - person being joined. |
| + provider is trusted for that address (§6.2). Linking from Your settings, |
| + and merging, always need a fresh confirmation of the person being joined. |
| + The only link without one is §4.2 step 2, where the provider is trusted |
| + for the address, which is as strong as an email link to it. Even that is |
| + refused for a person who holds a Keymail method. |
| - **A step-up downgrade.** A session must never re-confirm with something |
| weaker than the email-signin spec already allows. A Keymail session still |
| re-confirms with Keymail (email-signin §6). |
| @@ -131,14 +136,19 @@ Pressing a provider button runs that provider's flow (§5). When it comes back: |
| 1. If this provider identity is already linked to a person, that person is |
| signed in. |
| 2. Otherwise, if the provider vouches for an address it is trusted for |
| - (§6.2), and a person already has that address as a sign-in method, the |
| - provider identity is linked to that person and they are signed in. An |
| + (§6.2), and a person already has that address as an `email` method, the |
| + provider identity is linked to that person and they are signed in. If |
| + that person holds a Keymail method, they must first confirm with Keymail, |
| + so a provider can never become a way around the passkey. If the identity |
| + was removed from that person before (§4.3), it isn't relinked |
| + automatically: the person is asked to add it from Your settings. An |
| email goes to that address saying a new sign-in method was added, with a |
| way to remove it. |
| 3. Otherwise, if the address is trusted but belongs to nobody, a new person |
| - is created with that address as their contact address. This goes through |
| + is created with that address as their contact address and as an `email` |
| + method alongside the provider method. This goes through |
| the same first-landing path as email sign-up, which mints the personal |
| - account and applies plan defaults, and under the same sign-up rate limits. |
| + account and applies plan defaults, under the new-person limit (§9). |
| 4. Otherwise (the address isn't one the provider is trusted for), the |
| console asks for a one-time emailed code to that address before doing |
| step 2 or 3 (§6.2). If the console has no mailer, it says it can't finish |
| @@ -159,7 +169,11 @@ there a person can: |
| or code). If the identity already belongs to another person, the console |
| offers a merge (§7) and doesn't link it silently. |
| - **Remove a method.** This needs a fresh confirmation, and is refused when |
| - it is the last one. Removing the method behind the contact address asks |
| + it is the last one. It ends every browser session signed in through that |
| + method, and the step-ups those sessions earned. CLI tokens belong to the |
| + person, not the method, so they stay, and the notice lists them with a |
| + link to revoke. A removed provider identity is remembered as removed, so |
| + §4.2 step 2 won't silently attach it again. Removing the method behind the contact address asks |
| the person to pick a new contact address first. |
| - **Change the contact address** to any email-type address among their |
| methods, including one a provider vouched for under §6.2. This is the |
| @@ -171,8 +185,9 @@ address (and, for a change of contact, to the old one too). |
| ### 4.4 Invites |
| An invite is still sent to an address. A signed-in person can accept an |
| -invite addressed to any address they hold as a method, or that a provider |
| -vouched for under §6.2. They no longer have to be signed in "as" exactly |
| +invite addressed to any address they hold as an `email` or `keymail` |
| +method. A provider-vouched address counts only once it is an `email` method |
| +(§6.1). They no longer have to be signed in "as" exactly |
| that address. The seat and billing gates on accepting stay as they are. |
| ## 5. The three providers |
| @@ -199,15 +214,15 @@ and isn't moved onto this interface in this work. |
| - OIDC, scope `openid email`. Identity is `sub`. The address is `email` when |
| `email_verified` is true. |
| -- Step-up: re-run with `prompt=login` and `max_age`, then check `auth_time` |
| - in the ID token, the same way Keymail step-up checks it. |
| +- Step-up: by emailed code (P6, §8). Google doesn't support forced |
| + re-authentication requests from other sites. |
| - Config: `CARLOS_CONSOLE_GOOGLE_CLIENT_ID`, |
| `CARLOS_CONSOLE_GOOGLE_CLIENT_SECRET`. |
| ### 5.2 Apple |
| -- Sign in with Apple on the web, using a Services ID and scope `email` (and |
| - `name` is not requested, see §3). Apple needs `response_mode=form_post` |
| +- Sign in with Apple on the web, using a Services ID and scope `email` only |
| + (no `name`, see §3). Apple needs `response_mode=form_post` |
| when any scope is requested, so the callback is a **cross-site POST**. The |
| existing auth cookie is `SameSite=Lax` and won't come with it. The Apple |
| flow therefore needs its own state cookie with `SameSite=None; Secure`, or |
| @@ -277,7 +292,15 @@ A new table, `sign_in_methods`, is keyed by `(kind, subject)`: |
| provider's stable ID for the rest. |
| - `address`: the person, which is the `users.address` it signs in to. |
| - `vouched_email`: for providers, the verified address the provider gave |
| - most recently, together with whether it is trusted under §6.2. |
| + most recently, together with whether it is trusted under §6.2. This is |
| + informational. Holding an address always means having an `email` (or |
| + `keymail`) method for it, created at sign-up (§4.2 step 3), after a §6.2 |
| + code, or from Your settings. A later different address from the provider |
| + only updates `vouched_email`: it never adds, moves or removes an `email` |
| + method. Removing a provider method doesn't remove the `email` method it |
| + created. |
| +- `removed_at`: set when the person removes it (§4.3). The row stays, so |
| + the identity can't silently relink. |
| - `label`, `added_at`, `last_used_at`. |
| Migration: every existing user gets one method row for their own address, |
| @@ -291,9 +314,12 @@ another person's method after a merge therefore lands on the surviving |
| person. An email link to an address that is nobody's method creates a person, |
| as it does today. |
| -`sessions.method` gains `google`, `apple` and `github`. The step-up gate |
| -branches on all five, and an unknown value still fails closed |
| -(`stepup.go:295-306`). |
| +`sessions.method` gains `google`, `apple` and `github`, and sessions also |
| +record which method row they signed in through, so §4.3 can end them. |
| +Today the step-up gate sends every method other than `email`, including an |
| +unreadable one, down the Keymail path (`stepup.go:283-306`). The new gate |
| +names each method explicitly, and an unknown or unreadable value is refused |
| +outright rather than routed to Keymail. |
| ### 6.2 When a provider's word on an address is trusted |
| @@ -326,6 +352,15 @@ also from the Hide My Email sign-in. For that case, Your settings has an |
| "I already have an account with another address" action, which runs a |
| sign-in by the other method in a step-up-style flow. |
| +Operators are left out of merging. A merge or a contact-address change is |
| +refused for a person whose address holds the fleet-operator bit |
| +(`users.operator`, `store.go:2585`) or appears in an address allowlist |
| +(`CARLOS_SYSTEM_OPERATORS`, store operators, `apistore.go:644`). Those |
| +authorities are granted to exact addresses by deployment config, and moving |
| +them by a self-service merge would be a way to gain them. The refusal says |
| +to ask the platform's operators. Adding and removing sign-in methods is |
| +still allowed for operators. |
| + |
| ### 7.2 What the person sees and confirms |
| 1. A fresh confirmation of A (A's session method). |
| @@ -366,25 +401,31 @@ says so in the plan. |
| ## 8. Re-confirmation (step-up) |
| -- `keymail`: unchanged. |
| -- `email`: unchanged (fresh link or code to that address). |
| -- `google`: re-run Google with `prompt=login` and `max_age`, then check |
| - `auth_time` and that `sub` matches the session's method. |
| -- `apple` and `github`: emailed code to the person's contact address (P6). |
| +- **A person who holds a Keymail method always re-confirms with Keymail**, |
| + whichever method this session used. Linking a provider must never weaken |
| + a passkey person's step-up. |
| +- Otherwise `email` is unchanged (a fresh link or code to that address). |
| +- Otherwise `google`, `apple` and `github` get an emailed code to the |
| + person's contact address (P6). |
| This isn't a downgrade (§3), because email is already an allowed way to sign |
| -in for these people. A console with no mailer can't step up `apple` or |
| -`github` sessions, so for those people sensitive actions are refused with a |
| -message that says why. The console's start-up log warns when Apple or GitHub |
| -is on without a mailer. |
| +in for these people. A console with no mailer can't step up provider |
| +sessions, so for those people sensitive actions are refused with a message |
| +that says why. The console's start-up log warns when a provider is on |
| +without a mailer. |
| The CLI approval page (`authcli.go`) needs nothing new beyond this: it uses |
| the same session and the same step-up gate. |
| ## 9. Rate limits and abuse |
| -- Provider sign-ups count against the same new-person limits as email |
| - sign-up (email-signin §7). |
| +- There is no new-person limit today: the email limits count submits, sends |
| + and wrong codes (`emailsignin_limits.go:19`), and `finishSignin` creates |
| + users ungated. This work adds one **new-person budget**, per client IP and |
| + overall, checked where a `users` row would be created by any path (email, |
| + Keymail, provider). Returning sign-ins don't count against it. Provider |
| + traffic never spends the email-send budgets, apart from the codes it |
| + actually sends. |
| - Provider callbacks are limited per client IP, as the email submit is. |
| - §4.2 step 4 and §6.2 codes use the existing email-challenge store and its |
| caps. |
| @@ -420,8 +461,11 @@ logos follow each provider's brand guidelines, which are strict for Apple. |
| - Merge: the registry completeness test (§7.3). A merge with overlapping |
| teams keeps the higher role. CLI tokens keep working for the survivor. Old |
| sessions of B now act as the survivor. A refused merge changes nothing. |
| -- Step-up per method, including the Google `auth_time` check and the |
| - no-mailer refusal for Apple and GitHub. |
| +- Step-up per method: the emailed code for each provider, Keymail for a |
| + person holding Keymail whatever the session's method, refusal of an |
| + unknown method, and the no-mailer refusal. |
| +- Removal ends that method's sessions and prevents automatic relinking. |
| +- Operators: merge and contact change are refused. |
| - Device ordering: a table of user agents and `Sec-CH-UA-Platform` values |
| against the expected primary. |
| @@ -466,3 +510,26 @@ callback paths, the settings, and the Apple relay step. |
| - Splitting this into plans. A natural cut: (1) the person and method model, |
| migration, invites by any held address, and Your settings listing; (2) |
| Google and GitHub with step-up; (3) Apple; (4) link, unlink and merge. |
| + |
| +## 14. Builder check (rev 1 → rev 2) |
| + |
| +Astra read rev 1 as a builder. Its questions, and how they were settled |
| +(all as the designer's calls unless marked otherwise): |
| + |
| +1. §3 and §4.2 contradicted each other on automatic linking. Settled: |
| + automatic linking only for a trusted address, never to a Keymail holder |
| + (§4.2 step 2, §3). |
| +2. Google has no forced re-login, so P6 leaves all three providers stepping |
| + up by email (P6, §5.1, §8). Keymail holders always step up with Keymail. |
| +3. What a vouched address owns. Settled: holding means an `email` method. |
| + `vouched_email` is informational and later changes don't move anything |
| + (§6.1, §4.4). |
| +4. What removal revokes. Settled: that method's sessions and step-ups, not |
| + CLI tokens, plus a removed marker against relinking (§4.3, §6.1). |
| +5. Operators and merge. Settled: refused for operators and allowlisted |
| + addresses (§7.1). |
| +6. Which events share the sign-up limit. Settled: a new new-person budget |
| + across all paths (§9), since none exists today. |
| + |
| +It also corrected two claims about the code: the step-up fail-closed path |
| +(§6.1) and the existing sign-up limits (§9). |