Skip to content
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

Closed

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Dec 11, 2024

No description provided.

@Weiko Weiko marked this pull request as ready for review December 11, 2024 10:42
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Comment on lines +178 to +187
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,
);
}
Copy link
Contributor

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

@Weiko Weiko closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant