Add OAuth allowed domain restrictions - #428
Conversation
|
RamezWasfy seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughChangesOAuth domain allowlisting
Estimated code review effort: 3 (Moderate) | ~25 minutes Mergeability Score: ⚪ Minimal · up to The PR adds configurable OAuth domain restrictions and callback validation without any identified merge-blocking correctness, security, or availability risk; no actionable risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant GoogleOAuthProvider
participant OAuthCallbackController
participant isOAuthUserAllowedByDomain
participant AccountLookup
GoogleOAuthProvider->>OAuthCallbackController: return email and hosted domain
OAuthCallbackController->>isOAuthUserAllowedByDomain: validate OAuth user domain
isOAuthUserAllowedByDomain-->>OAuthCallbackController: authorization result
OAuthCallbackController->>AccountLookup: continue after authorized callback
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
OAUTH_ALLOWED_DOMAINSsupport for domain-restricted OAuth sign-in/sign-uphd) validationValidation
pnpm --filter @openpanel/auth run typecheckpnpm --filter @openpanel/trpc run typecheckpnpm --filter @openpanel/api run typecheckpnpm exec ultracite check packages/auth/src/oauth-allowed-domains.ts packages/auth/oauth-allowed-domains.test.ts packages/trpc/src/routers/auth.ts apps/api/src/controllers/oauth-callback.controller.tsx apps/public/content/docs/self-hosting/environment-variables.mdx self-hosting/.env.templateNote: the repo Vitest workspace global setup requires local Postgres and ClickHouse services, so the focused Vitest run cannot complete in this local worktree without those services.
Summary by CodeRabbit
New Features
Documentation
OAUTH_ALLOWED_DOMAINS, including configuration and provider-specific behavior.