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

feat(custom-domain): allow to use custom domain #9106

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f807021
WIP
AMoreaux Dec 16, 2024
7b746e6
Merge remote-tracking branch 'origin/main' into feat/allow-to-use-cus…
AMoreaux Dec 16, 2024
329ff83
feat(domain-manager): centralize and extend subdomain handling
AMoreaux Dec 17, 2024
3fa8df1
refactor(workspace, domain-manager): replace 'domain' with 'hostname'
AMoreaux Dec 18, 2024
1256151
add migration
AMoreaux Dec 18, 2024
f184330
WIP
AMoreaux Dec 16, 2024
8d3d5b4
feat(domain-manager): centralize and extend subdomain handling
AMoreaux Dec 17, 2024
34ad83c
refactor(workspace, domain-manager): replace 'domain' with 'hostname'
AMoreaux Dec 18, 2024
f06effe
add migration
AMoreaux Dec 18, 2024
36ea594
Merge remote-tracking branch 'origin/feat/allow-to-use-custom-domain'…
AMoreaux Dec 23, 2024
24653e0
WIP
AMoreaux Dec 24, 2024
6e66db1
WIP
AMoreaux Dec 24, 2024
f4b35df
Merge remote-tracking branch 'origin/main' into feat/allow-to-use-cus…
AMoreaux Dec 24, 2024
c62e0f8
WIP
AMoreaux Jan 6, 2025
c64136b
Merge remote-tracking branch 'origin/main' into feat/allow-to-use-cus…
AMoreaux Jan 7, 2025
4fc89b3
[refactor](auth): Simplify invitation handling and SSO flow
AMoreaux Jan 7, 2025
e658f75
WIP
AMoreaux Jan 8, 2025
78652c2
[refactor]: Remove switch workspace functionality
AMoreaux Jan 9, 2025
a4482a2
[refactor]: Simplify domain settings components
AMoreaux Jan 9, 2025
21b8ce6
[refactor]: Simplify domain settings components
AMoreaux Jan 9, 2025
a94c9f7
Merge remote-tracking branch 'origin/main' into feat/allow-to-use-cus…
AMoreaux Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ dump.rdb
/devenv.nix
/flake.lock
/flake.nix
/qodana.yaml
6 changes: 3 additions & 3 deletions packages/twenty-front/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ module.exports = {
},
plugins: ['project-structure'],
settings: {
'project-structure/folder-structure-config-path':path.resolve(
'project-structure/folder-structure-config-path': path.resolve(
__dirname,
'folderStructure.json'
)
'folderStructure.json',
),
},
rules: {
'project-structure/folder-structure': 'error',
Expand Down
2 changes: 2 additions & 0 deletions packages/twenty-front/codegen-metadata.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

Check failure

Code scanning / CodeQL

Disabling certificate validation High

Disabling certificate validation is strongly discouraged.

Copilot Autofix AI 16 days ago

To fix the problem, we should ensure that certificate validation is not disabled. This can be done by removing the line that sets process.env.NODE_TLS_REJECT_UNAUTHORIZED to '0'. If this setting is necessary for development or testing purposes, it should be conditionally applied based on the environment.

The best way to fix this without changing existing functionality is to check if the environment is development or testing before setting process.env.NODE_TLS_REJECT_UNAUTHORIZED. This way, we can ensure that certificate validation is only disabled in non-production environments.

Suggested changeset 1
packages/twenty-front/codegen-metadata.cjs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/twenty-front/codegen-metadata.cjs b/packages/twenty-front/codegen-metadata.cjs
--- a/packages/twenty-front/codegen-metadata.cjs
+++ b/packages/twenty-front/codegen-metadata.cjs
@@ -1,2 +1,4 @@
-process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
+if (process.env.NODE_ENV !== 'production') {
+  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
+}
 
EOF
@@ -1,2 +1,4 @@
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
}

Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

module.exports = {
schema:
(process.env.REACT_APP_SERVER_BASE_URL ?? 'http://localhost:3000') +
Expand Down
2 changes: 2 additions & 0 deletions packages/twenty-front/codegen.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

Check failure

Code scanning / CodeQL

Disabling certificate validation High

Disabling certificate validation is strongly discouraged.

Copilot Autofix AI 18 days ago

To fix the problem, we need to ensure that TLS certificate validation is not disabled. This involves removing or modifying the line that sets process.env.NODE_TLS_REJECT_UNAUTHORIZED to '0'. If this setting is required for development or testing purposes, it should be conditionally applied based on the environment, ensuring it is never used in production.

The best way to fix this without changing existing functionality is to conditionally set process.env.NODE_TLS_REJECT_UNAUTHORIZED based on an environment variable that explicitly indicates a development or testing environment. This way, we can maintain security in production while allowing flexibility in non-production environments.

Suggested changeset 1
packages/twenty-front/codegen.cjs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/twenty-front/codegen.cjs b/packages/twenty-front/codegen.cjs
--- a/packages/twenty-front/codegen.cjs
+++ b/packages/twenty-front/codegen.cjs
@@ -1,2 +1,4 @@
-process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
+if (process.env.NODE_ENV !== 'production') {
+  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
+}
 
EOF
@@ -1,2 +1,4 @@
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
}

Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

module.exports = {
schema:
(process.env.REACT_APP_SERVER_BASE_URL ?? 'http://localhost:3000') +
Expand Down
46 changes: 33 additions & 13 deletions packages/twenty-front/src/generated-metadata/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export type AuthorizeApp = {
export type AvailableWorkspaceOutput = {
__typename?: 'AvailableWorkspaceOutput';
displayName?: Maybe<Scalars['String']['output']>;
hostname?: Maybe<Scalars['String']['output']>;
id: Scalars['String']['output'];
logo?: Maybe<Scalars['String']['output']>;
sso: Array<SsoConnection>;
Expand Down Expand Up @@ -305,6 +306,14 @@ export type CursorPaging = {
last?: InputMaybe<Scalars['Int']['input']>;
};

export type CustomHostnameDetails = {
__typename?: 'CustomHostnameDetails';
hostname: Scalars['String']['output'];
ownership_verification?: Maybe<OwnershipVerification>;
ownership_verification_http?: Maybe<OwnershipVerificationHttp>;
status: Scalars['String']['output'];
};

export type DeleteOneFieldInput = {
/** The id of the field to delete. */
id: Scalars['UUID']['input'];
Expand Down Expand Up @@ -395,6 +404,7 @@ export enum FeatureFlagKey {
IsCommandMenuV2Enabled = 'IsCommandMenuV2Enabled',
IsCopilotEnabled = 'IsCopilotEnabled',
IsCrmMigrationEnabled = 'IsCrmMigrationEnabled',
IsCustomDomainEnabled = 'IsCustomDomainEnabled',
IsEventObjectEnabled = 'IsEventObjectEnabled',
IsFreeAccessEnabled = 'IsFreeAccessEnabled',
IsFunctionSettingsEnabled = 'IsFunctionSettingsEnabled',
Expand All @@ -405,7 +415,6 @@ export enum FeatureFlagKey {
IsSsoEnabled = 'IsSSOEnabled',
IsStripeIntegrationEnabled = 'IsStripeIntegrationEnabled',
IsUniqueIndexesEnabled = 'IsUniqueIndexesEnabled',
IsViewGroupsEnabled = 'IsViewGroupsEnabled',
IsWorkflowEnabled = 'IsWorkflowEnabled'
}

Expand Down Expand Up @@ -511,7 +520,7 @@ export enum IdentityProviderType {
export type ImpersonateOutput = {
__typename?: 'ImpersonateOutput';
loginToken: AuthToken;
workspace: WorkspaceSubdomainAndId;
workspace: WorkspaceSubdomainHostnameAndId;
};

export type IndexConnection = {
Expand Down Expand Up @@ -621,7 +630,6 @@ export type Mutation = {
sendInvitations: SendInvitationsOutput;
signUp: SignUpOutput;
skipSyncEmailOnboardingStep: OnboardingStepSuccess;
switchWorkspace: PublicWorkspaceDataOutput;
syncRemoteTable: RemoteTable;
syncRemoteTableSchemaChanges: RemoteTable;
track: Analytics;
Expand Down Expand Up @@ -852,11 +860,6 @@ export type MutationSignUpArgs = {
};


export type MutationSwitchWorkspaceArgs = {
workspaceId: Scalars['String']['input'];
};


export type MutationSyncRemoteTableArgs = {
input: RemoteTableInput;
};
Expand Down Expand Up @@ -992,6 +995,19 @@ export type OnboardingStepSuccess = {
success: Scalars['Boolean']['output'];
};

export type OwnershipVerification = {
__typename?: 'OwnershipVerification';
name: Scalars['String']['output'];
type: Scalars['String']['output'];
value: Scalars['String']['output'];
};

export type OwnershipVerificationHttp = {
__typename?: 'OwnershipVerificationHttp';
http_body: Scalars['String']['output'];
http_url: Scalars['String']['output'];
};

export type PageInfo = {
__typename?: 'PageInfo';
/** The cursor of the last returned record. */
Expand Down Expand Up @@ -1030,6 +1046,7 @@ export type PublicWorkspaceDataOutput = {
__typename?: 'PublicWorkspaceDataOutput';
authProviders: AuthProviders;
displayName?: Maybe<Scalars['String']['output']>;
hostname?: Maybe<Scalars['String']['output']>;
id: Scalars['String']['output'];
logo?: Maybe<Scalars['String']['output']>;
subdomain: Scalars['String']['output'];
Expand Down Expand Up @@ -1059,6 +1076,7 @@ export type Query = {
findWorkspaceFromInviteHash: Workspace;
findWorkspaceInvitations: Array<WorkspaceInvitation>;
getAvailablePackages: Scalars['JSON']['output'];
getHostnameDetails?: Maybe<CustomHostnameDetails>;
getPostgresCredentials?: Maybe<PostgresCredentials>;
getProductPrices: ProductPricesEntity;
getPublicWorkspaceDataBySubdomain: PublicWorkspaceDataOutput;
Expand Down Expand Up @@ -1412,7 +1430,7 @@ export type SetupSsoOutput = {
export type SignUpOutput = {
__typename?: 'SignUpOutput';
loginToken: AuthToken;
workspace: WorkspaceSubdomainAndId;
workspace: WorkspaceSubdomainHostnameAndId;
};

/** Sort Directions */
Expand Down Expand Up @@ -1612,7 +1630,8 @@ export type UpdateWorkflowVersionStepInput = {
export type UpdateWorkspaceInput = {
allowImpersonation?: InputMaybe<Scalars['Boolean']['input']>;
displayName?: InputMaybe<Scalars['String']['input']>;
domainName?: InputMaybe<Scalars['String']['input']>;
domain?: InputMaybe<Scalars['String']['input']>;
hostname?: InputMaybe<Scalars['String']['input']>;
inviteHash?: InputMaybe<Scalars['String']['input']>;
isGoogleAuthEnabled?: InputMaybe<Scalars['Boolean']['input']>;
isMicrosoftAuthEnabled?: InputMaybe<Scalars['Boolean']['input']>;
Expand Down Expand Up @@ -1741,9 +1760,9 @@ export type Workspace = {
databaseUrl: Scalars['String']['output'];
deletedAt?: Maybe<Scalars['DateTime']['output']>;
displayName?: Maybe<Scalars['String']['output']>;
domainName?: Maybe<Scalars['String']['output']>;
featureFlags?: Maybe<Array<FeatureFlag>>;
hasValidEntrepriseKey: Scalars['Boolean']['output'];
hostname?: Maybe<Scalars['String']['output']>;
id: Scalars['UUID']['output'];
inviteHash?: Maybe<Scalars['String']['output']>;
isGoogleAuthEnabled: Scalars['Boolean']['output'];
Expand Down Expand Up @@ -1852,8 +1871,9 @@ export type WorkspaceNameAndId = {
id: Scalars['String']['output'];
};

export type WorkspaceSubdomainAndId = {
__typename?: 'WorkspaceSubdomainAndId';
export type WorkspaceSubdomainHostnameAndId = {
__typename?: 'WorkspaceSubdomainHostnameAndId';
hostname?: Maybe<Scalars['String']['output']>;
id: Scalars['String']['output'];
subdomain: Scalars['String']['output'];
};
Expand Down
Loading
Loading