feat(dashboard-api): add OIDC admin user bootstrap endpoint#2841
feat(dashboard-api): add OIDC admin user bootstrap endpoint#2841ben-fornefeld wants to merge 1 commit into
Conversation
PR SummaryHigh Risk Overview Provisioning now ties public users to A small router regression test confirms static Reviewed by Cursor Bugbot for commit 82a6e8b. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new admin endpoint /admin/users/bootstrap to bootstrap users authenticated via generic OIDC providers. It adds the corresponding request schema, handler implementation, and database query updates to safely handle concurrent bootstrap requests by resolving identity conflicts and cleaning up orphan user records. Comprehensive unit tests have also been added to verify the routing, OIDC issuer validation, and concurrent bootstrap behavior. No review comments were provided, and there are no critical findings or feedback to report.
❌ 5 Tests Failed:
View the full list of 5 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6222cb0dd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| canonicalUserID, err := authTxDB.UpsertPublicIdentity(ctx, authqueries.UpsertPublicIdentityParams{ | ||
| OidcIss: identity.Issuer, | ||
| OidcSub: identity.Subject, | ||
| UserID: candidateUserID, | ||
| }) |
There was a problem hiding this comment.
Resolve freshly bootstrapped identities from primary
When AUTH_DB_READ_REPLICA_CONNECTION_STRING points at a lagging replica, this endpoint can return 200 after inserting the (iss, sub) row on the primary, but the next OIDC-authenticated request still resolves identities through authDB.Read in packages/auth/pkg/auth/service.go:77. That makes the bootstrap flow intermittently fail with 401 until replication catches up; the OIDC login path needs to read the newly created identity from primary or otherwise wait/invalidate before reporting success.
Useful? React with 👍 / 👎.
ee666da to
6fef570
Compare
Add POST /admin/users/bootstrap for dashboard Ory sign-in provisioning, with issuer allow-listing, identity upsert concurrency handling, and a route conflict regression test.
6fef570 to
82a6e8b
Compare
Summary
POST /admin/users/bootstrapfor OIDC user provisioning (issuer, subject, email, optional name).public.usersandpublic.user_identitiesbefore default team creation, with issuer allow-listing aligned to the Ory profile resolver.POST /admin/users/bootstrapandPOST /admin/users/{userId}/bootstrap.Stack
Stacks on #2840 (Ory user profile provider). Merge #2840 first, then rebase this onto
mainor merge the stack.Dashboard Ory sign-in (
dashboard.full-stackPR #342) depends on this PR landing.