Repository navigation
feat(idp-provider): federated doors (GitHub/Google/Microsoft) + runtime identity linking - #13782
Merged
Merged
Conversation
Implements the door machinery for #13411 (GitHub), #13412 (Google), #13414 (Microsoft) and the linking model of #13415 on the minimal provider (#13409, closed): - GET /door/{name}/start re-validates the RP authorize request with the same checks as /authorize, parks it server-side under a single-use state handle (300 s), and redirects upstream. The callback consumes the handle, exchanges the upstream code, and verifies the upstream identity: OIDC doors check the ID token against the upstream JWKS (iss/aud/exp/nonce, PKCE sent upstream); the GitHub door takes the numeric user id from the user fetch. - The deny-by-default allowlist is enforced in the provider before any link or code exists; success mints one of our own codes into the shared store, so a door login's tokens carry the same account sub and #1253 role claims as a local login's. - Identity store (#13415): SQLite link state seeded from the provider config, append-only event history (rows never hard-deleted), first-allowlisted-login linking written to the history and the audit record, operator link/unlink/links CLI. An unlinked identity is denied at its door while the account stays reachable via the others. - Door client secrets are named env vars only (the launcher fills them from the vault by name); a door without its secret stays disabled and denies at start with an audit record. Tests: 7 new door tests over real HTTP against mock OIDC/GitHub upstreams (full loops, denial/audit, unlink behaviour, state replay, disabled door); 15/15 crate tests pass on the laptop. The live per-door sign-in proofs still need the upstream app registrations recorded on each issue; the issues stay open for those.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #13411, #13412, #13414, #13415 (all four stay open — see "What this does not do" below). Builds on the closed stand-up #13409 under the story #13658.
What lands
Federated doors (
src/doors.rs,src/upstream.rs) —GET /door/{name}/start|callbackonpkgs/idp-provider:/authorizeuses (static client registry, redirect URI, code + PKCE S256,openidscope — the validation is now shared code), parks the request server-side under a random single-use state handle (300 s TTL), and redirects to the upstream.iss/aud/exp/noncechecked; the recorded subject is the configured claim (sub; Microsoftoid, falling back tosub). GitHub door: subject is the numeric useridfrom the user fetch.sub, same design(pm-stack): one identity across the stack — SSO propagation from the public entry into every layer, roles replace asserted authorship #1253 role claims.idp.github.client-secret→IDP_GITHUB_CLIENT_SECRET, likewise Google/Microsoft). A door whose secret is unset — or an OIDC door missing issuer/JWKS — stays disabled: its start endpoint denies with an audit record; the rest of the provider is unaffected.Account linking (
src/identities.rs) — the #13415 model, refined on the issue before building: link state moves from static config rows to a runtime SQLite store seeded from the config. One row per(provider, subject)(active | unlinked, never hard-deleted) plus an append-only, trigger-protected event history (seed/link/relink/unlink). An allowlisted identity's first door login links it (actordoor-login), recorded in the history and the audit record; an operator unlink (newidp-provider link|unlink|linksCLI) is never silently undone by a login — that door deniesidentity_unlinkedwhile the account stays reachable via the others.The local door now checks the same store for its linked check; its behaviour is otherwise unchanged.
Evidence
Laptop, in the worktree: 15/15 crate tests pass — the 8 pre-existing (endpoints 3, flow 5) plus 7 new door tests (
tests/doors.rs) that run the full loop over real HTTP against mock OIDC/GitHub upstreams: both doors reach the same account with role claims; first-login linking + audit; non-allowlisted denial + audit with no store row; unlink → door denied, local door still opens the account, history intact; state-handle replay denied; disabled door denied at start; login form lists enabled doors only. The mock OIDC upstream enforces PKCE and nonce itself, so the provider's upstream behaviour is genuinely exercised.config.example.jsongains the three production-shaped door entries (placeholder client ids; the Microsoft issuer carries the consumers tenant id — flagged in the file's comment to verify against the registration) and the README documents the doors, linking, and the new env surface.What this does not do
The live "Drew signs in via each door" proofs: no upstream app registrations exist yet (checked the vault by name; creating them is a signed-in console step per door). The exact registration steps and vault names are recorded on #13411 / #13412 / #13414, and the linking acceptance mapping on #13415. Those issues stay open on the registration proof; nothing here closes them.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.