-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block google signinup on wrong subdomain #9015
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR implements security measures to prevent unauthorized Google SSO authentication by validating workspace subdomains and displaying relevant error messages to users.
- Added new
ErrorToastProvider
in/packages/twenty-front/src/modules/error-handler/components/ErrorToastProvider.tsx
to display authentication errors from URL parameters - Modified
/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
to block sign-ups on non-default subdomains when multi-workspace is enabled - Extracted and made public
hasAccessToWorkspace
method in/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
for reusable workspace access validation - Simplified
/packages/twenty-server/src/engine/core-modules/auth/controllers/google-auth.controller.ts
by removing redundant workspace checks and delegating to AuthService
5 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile
packages/twenty-front/src/modules/error-handler/components/ErrorToastProvider.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/error-handler/components/ErrorToastProvider.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
Show resolved
Hide resolved
if ( | ||
this.environmentService.get('IS_MULTIWORKSPACE_ENABLED') && | ||
targetWorkspaceSubdomain !== | ||
this.environmentService.get('DEFAULT_SUBDOMAIN') | ||
) { | ||
throw new AuthException( | ||
'You are not allowed to sign up on this domain', | ||
AuthExceptionCode.FORBIDDEN_EXCEPTION, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: this check prevents sign-ups on non-default subdomains but should also verify the user doesn't have an existing account on any workspace before blocking
No description provided.