-
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
Use uuid package instead of crypto package #9191
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 replaces the crypto package with uuid v4 for generating unique identifiers, addressing console errors in Docker environments without HTTPS configuration.
- Replaced
crypto.randomUUID()
withuuid.v4()
in/packages/twenty-front/src/modules/analytics/hooks/useEventTracker.ts
for session ID generation - Modified
/packages/twenty-front/src/modules/settings/security/utils/sSOIdentityProviderDefaultValues.ts
to useuuid.v4()
for SSO provider ID generation - Maintains secure cookie settings with 'secure' flag in analytics tracking
- Simplifies UUID generation code while preserving functionality across all environments
2 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4))) | ||
).toString(16), | ||
), | ||
id: v4(), |
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: The OIDC provider is missing an 'id' field while SAML has one. This inconsistency could cause issues with provider identification.
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.
@AMoreaux good point raised by Geptile, is there a reason for this?
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.
Yes it's expected. It's because to generate the saml provider we need to know the id before save the row. For OIDC it's useless.
@@ -19,7 +20,7 @@ export const getSessionId = (): string => { | |||
}; | |||
|
|||
export const setSessionId = (domain?: string): void => { | |||
const sessionId = getSessionId() || crypto.randomUUID(); | |||
const sessionId = getSessionId() || v4(); | |||
const baseCookie = `${ANALYTICS_COOKIE_NAME}=${sessionId}; Max-Age=1800; path=/; secure`; |
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.
style: Cookie lacks 'SameSite' attribute which is recommended for secure cookies
Fixes #9186