Skip to content

SSO (#9077): pending-link registration — new provider sign-ins register without trust until approved from an established session #13972

Backlog

Description

@dezren39

Refs #13415, #9077. Policy: Drew's identity-linking policy, recorded on #13415 §1–§2. Design record: the dated record design_idp-linking-policy in doc/ (indexed in doc/README.md), landing with this filing.

1. Problem + context

Today a door login is the link. In pkgs/idp-provider/src/identities.rs an allowlisted identity arriving at a door for the first time is inserted as active by that login (actor door-login) and immediately mints tokens for the account — proven live on the Google door (#13415, comment 7115835098). The identity store knows exactly two states, active | unlinked; there is no registered-but-untrusted state, and there is no account-creation path: the account row exists because config seeded it.

That was safe only because the trust assertion lives in the operator-curated allowlist (Drew's exact upstream account IDs, deny-by-default). Drew's policy changes the model:

  • All doors link to the same user, but a new provider sign-in does not automatically gain trust. It is registered, and gains true access only when the user — signed in via an already-established provider — approves the link as the same account. After approval, either provider signs in fully; a third provider is added the same way.
  • Any new Microsoft/Google/GitHub sign-in auto-creates our own CA SSO account (policy §2). Auto-provisioning removes the hand-curated allowlist as the trust anchor, which makes the pending state load-bearing rather than decorative.

Two structural gaps ride along: the minimal provider deliberately has no authenticated session layer (#13415, comment 7114329166 — a self-service linking UI "would presuppose an authenticated session layer the minimal provider deliberately does not have"), and approval-from-an-established-session is exactly a session-layer act. And a pending registration needs a claim: some signal proposing that this new provider identity belongs to that existing account, for the established session to approve or reject.

2. Goals / non-goals

Goals:

  • A third identity state, pending, in the runtime identity store: registered, sign-in acknowledged, no tokens, no account access, distinct from unlinked (denied) and active.
  • The account-establishing (first) provider sign-in keeps working as it does today, including auto-provisioning a new CA SSO account for a genuinely new user.
  • Subsequent provider sign-ins register as pending claims against an account; approval (and rejection) happens from an authenticated session established via an already-active identity, and is written to the identity history and the audit record, like every other link event.
  • Existing behaviour for the live doors is preserved: seeded identities and the live-proven Google link stay active; operator link|unlink|links CLI flows keep working.

Non-goals: passkeys (the passkey workstream), factor policies (the factor-policy workstream), account merge (the account-merge workstream), recovery requests and account deletion (policy undecided — Drew, see §8), lifting the Drew-only gate to named other users (a separate ruled change per the design note).

3. Alternatives

  • Do nothing (allowlist auto-link forever). Rejected by the policy itself: it only stays safe while every identity is hand-listed by the operator, and it cannot support auto-provisioning at all.
  • Operator-CLI approval only (pending registrations approved via idp-provider link, like today's unlink flow). Keeps the no-session-layer minimalism, but contradicts the policy: approval must come from the user in their established session, not from an operator shell. Acceptable only as an interim slice, not the end state.
  • Email-match auto-claim with approval (chosen direction, §4): a new provider sign-in whose verified upstream email matches the account's established email registers a pending claim against that account; no match → auto-provision a fresh account (policy §2) whose own first provider is its establishing one. Approval still always comes from the established session — the match proposes, the session disposes.
  • Initiated-from-session add flow only ("add a provider" button starts the door flow from inside the established session, so the claim is born authenticated). Strongest security shape, worst standalone UX (a Microsoft-first sign-in on a new device can't self-register). Chosen approach combines it with the email-match claim: both produce the same pending row and the same approval act.

4. Chosen approach

Data model (identities + identity_events in pkgs/idp-provider/src/identities.rs): add status pending to the identity row, plus claimed_via (session-add | email-match | door-login) and claim timestamp on the row; add event kinds register, approve, reject to the append-only history (existing seed | link | relink | unlink unchanged; history stays trigger-protected, never hard-deleted). A pending identity's door login returns a distinct audited outcome (identity_pending) — the sign-in is acknowledged as registered, no code/token is issued for the target account.

Approval surface: the minimal authenticated session the provider has so far avoided, scoped to exactly this job: a session established by completing a door login with an active identity can list pending claims against its account and approve/reject them. Session is a short-lived, provider-issued, account-bound credential used only for account-management acts (this issue's approvals; later the passkey workstream passkey ceremonies and the factor-policy workstream factor configuration build on it). No general-purpose login session for relying parties is introduced — tokens for apps remain the existing code+PKCE flow.

Claim creation: (i) from inside an established session, "add provider" starts the door flow and the returning identity registers as pending with claimed_via=session-add; (ii) a cold door sign-in by an unrecognised identity whose upstream verified email matches an existing account's email registers pending with claimed_via=email-match; (iii) no match → auto-provision: a new account row is created, this identity becomes its establishing active identity, event provision recorded. Drew's own doors: identities already allowlisted/seeded remain active — the pending path applies to identities the store has never seen.

Security analysis: the pending state is the control — registration alone yields nothing: no tokens, no role claims, no userinfo. Email match is a proposal mechanism only; a matching-email sign-in by an attacker registers a claim the real user can reject (and the rejection is audited), it never activates silently. Approval requires possession of an established factor path (an active door session), which is the policy's stated trust anchor. Every transition (register/approve/reject/provision, pending door attempts) is audited, so a claim-spam pattern is visible in the record. Residual risk named honestly: claim spam against an account is a nuisance/DoS surface — rate-limit pending registrations per account and per provider subject in slice 3.

5. Build slices (dependency-ordered, each with acceptance)

  1. Store: pending state + events. pending status, claim fields, register/approve/reject/provision events, identity_pending door outcome (no token issuance). Acceptance: unit + tests/doors.rs coverage — pending identity denied tokens but acknowledged; seeded/active behaviour byte-identical to today; history records the full transition sequence.
  2. Auto-provisioning. Unrecognised sign-in with no email match creates a new account with the identity as its establishing active identity. Acceptance: a brand-new mock-upstream user signs in and reaches their own new account; Drew's seeded account is untouched; provisioning is audited.
  3. Claims + approval surface. Email-match claim creation, session-add claim creation, the minimal account session, approve/reject acts, registration rate limits. Acceptance: the policy's example flow runs end to end over real HTTP against mock upstreams — Google-established account, cold Microsoft sign-in registers pending and gets no access, Google session approves, Microsoft then signs in fully; rejection path equally proven; GitHub added the same way.
  4. Live-door proof. Re-run the SSO (#9077): account linking UI/flow with retained identity history #13415 linking proof shape on the live doors once SSO (#9077): GitHub federated login #13411/SSO (#9077): Microsoft federated login #13414 registrations land: a genuinely new identity on a live door registers pending and is approved from the established session. Acceptance: the proof comment on SSO (#9077): account linking UI/flow with retained identity history #13415 with event history shown.

6. Rollout + rollback

Ships behind the existing provider binary; the store migration is additive (new status value + columns with defaults), so the current binary's data stays readable. Rollback = deploy the previous binary: rows in pending are simply never activated (previous code denies unknown-state identities at the door, which is the safe direction), and no history is rewritten either way.

7. Verification plan

Crate test suite (incl. new tests/doors.rs cases per slice) green in CI on main; the slice-3 end-to-end flow is the policy's own example, run over real HTTP against mock upstreams; slice 4 repeats it on live doors when registrations allow. Manual check: idp-provider links shows pending rows distinctly.

8. Open questions (named deciders)

  • Recovery requests and account deletion policy — Drew (explicitly undecided, policy §6; not designed here).
  • Whether email-match claims are offered at all in v1, or session-add is the only claim path — Drew (the design above includes both; dropping email-match is a scope cut he can rule).
  • Session lifetime/mechanics for the account-management session — implementer, within §4's scoping (short-lived, account-bound, management acts only).

Dependencies

HEAD of the linking-policy workstream: no sibling dependency. the passkey workstream (passkeys) and the factor-policy workstream (factor policies) build on this issue's account session and identity-state model; the account-merge workstream (merge) is independent of this issue but its uniqueness audit should complete before the passkey workstream adds passkey objects.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-24T01:26:17Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Activity

  1. added
    kind/feature
    epic/pm-stack
    on Nov 24, 2026
  2. developing-today commented on Nov 24, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    Sibling map — filed together 2026-11-24 as the four workstreams of Drew's identity-linking policy (recorded on #13415):

    Dependency order: (a) first; (b) builds on (a)'s account session; (c) builds on (a) + (b); (d) is independent of (a)–(c) mechanically, except its uniqueness audit (slice 1) should complete before (b)'s schema lands, and merge initiation uses (a)'s session. Issue bodies refer to siblings by workstream name; this comment is the number map.

  4. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    Slice 1 PR: #14019 (unmerged, touches only pkgs/idp-provider/).

    • Commits: 7764569cf37 (feature), 7ed78b66311 (docs), 76530ecbc93 (test fix: check the register event without relying on seed-row order).
    • Remote cargo test --manifest-path pkgs/idp-provider/Cargo.toml passed on 76530ecbc93: run https://github.com/dezren39/fleet/actions/runs/45309618341.
    • Earlier run 45307928695 failed on that assertion; the fix is the only change since.
  5. added a commit that references this issue on Nov 24, 2026
  6. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    Triage verdict (queue task 22482, coverage reconciliation pass 2, 2026-11-24) — not resolved; slices 2–4 remain.

    Fresh state check against main:

    • Slice 1 merged as PR idp-provider: pending identity state and door denial (slice 1 of #13972) #14019: pending status, register_pending / approve_pending / reject_pending / record_provision in pkgs/idp-provider/src/identities.rs, identity_pending door outcome, covered by tests/doors.rs.
    • But no runtime caller invokes register_pending or record_provision outside identities.rs — the door flow still cannot auto-provision an account or register a pending claim.

    Routed:

    • Slice 2 (auto-provisioning) → queue task 22744 (repo-health-code-pilot, priority 50): wire the door flow — unseen identity with no email match auto-provisions its own account; email match registers pending with claimed_via=email-match, no tokens.
    • Slice 3 (claims + approval surface) — next after slice 2 lands: minimal account session, approve/reject acts, registration rate limits. Not enqueued yet (depends on slice 2's door-flow wiring).
    • Slice 4 (live-door proof) — parked behind slice 3 plus SSO (#9077): GitHub federated login #13411/SSO (#9077): Microsoft federated login #13414 registrations.

    Open questions in §8 (recovery/deletion policy; whether email-match claims ship in v1) remain with Drew and do not block slice 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic/pm-stackkind/featurestatus:in-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions