Uh oh!
There was an error while loading. Please reload this page.
improvement(sso): fix provider lookup, migrate UI to emcn, add enterprise SSO docs - #4238
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Hardens provider registration and metadata generation: Refactors the SSO settings UI to Reviewed by Cursor Bugbot for commit aeafa27. Configure here. |
Greptile SummaryThis PR closes out a multi-round SSO security hardening cycle while also improving the admin UI and adding enterprise documentation. All previously-flagged issues (org membership guard on both GET and POST routes, OIDC Confidence Score: 5/5Safe to merge — all previously flagged security issues are resolved and the only remaining finding is a minor P2 timing optimization. All P0/P1 findings from prior rounds (membership guard, secret redaction, ownership-scoped REDACTED_MARKER lookup, SAML entityID) are confirmed fixed. The one new finding is a P2 UX timing issue where the providers query fires once before organizationId is available — harmless due to keepPreviousData and the skeleton loading state, but wasteful. No files require special attention; sso-settings.tsx has the minor timing note but is otherwise clean. Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as SSO Settings UI
participant Hook as useSSOProviders / useConfigureSSO
participant GET as GET /api/auth/sso/providers
participant POST as POST /api/auth/sso/register
participant DB as Database (member / ssoProvider)
participant BA as Better Auth registerSSOProvider
UI->>Hook: mount with organizationId
Hook->>GET: GET ?organizationId=orgId
GET->>DB: verify membership + role (owner/admin)
DB-->>GET: membership record
GET->>DB: SELECT ssoProvider WHERE organizationId=orgId
DB-->>GET: provider row
GET-->>Hook: providers (clientSecret REDACTED_MARKER)
Hook-->>UI: render existing provider
UI->>Hook: handleSubmit (Save / Update)
Hook->>POST: POST {providerId, orgId, providerType, ...}
POST->>DB: verify membership + role
DB-->>POST: membership OK
alt OIDC + REDACTED_MARKER secret
POST->>DB: SELECT oidcConfig WHERE providerId AND organizationId
DB-->>POST: stored clientSecret
end
POST->>BA: registerSSOProvider(providerConfig)
BA-->>POST: {providerId}
POST-->>Hook: {success: true}
Hook->>DB: invalidateQueries(ssoKeys.providers())
Hook-->>UI: toast success / error
Reviews (12): Last reviewed commit: "fix(sso): use issuer as entityID in auto..." | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 20, 2026
Fixed in 6183a98. Added an explicit membership check in |
waleedlatif1
commented
Apr 20, 2026
Fixed in 6183a98. The |
waleedlatif1
commented
Apr 20, 2026
waleedlatif1
commented
Apr 20, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…, remove fullError leak
waleedlatif1
commented
Apr 20, 2026
waleedlatif1
commented
Apr 20, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 20, 2026
waleedlatif1
commented
Apr 20, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 20, 2026
waleedlatif1
commented
Apr 20, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 20, 2026
waleedlatif1
commented
Apr 20, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…osted org admin guard
waleedlatif1
commented
Apr 20, 2026
waleedlatif1
commented
Apr 20, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 20, 2026
waleedlatif1
commented
Apr 20, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 20, 2026
waleedlatif1
commented
Apr 20, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit aeafa27. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Summary
getUserOrganization(could return wrong org) — now passesorganizationIdas query param from the active org contextorgIdto Zod schemas in register route so it's no longer stripped before DB insertgetBaseUrl())error.error || error.detailsonSuccess→onSettledfor cache invalidation so it fires on both success and errorshowAdvancedfrom formData into ownuseState(was leaking UI state into API payload)hasChanges()dirty check)organizationProvisioningin Better Auth SSO plugin so SSO users are auto-added to orgsType of Change
Testing
Tested manually
Checklist