Skip to content

Commit b19fa73

Browse files
chore: remove deprecated env-var identity provider configuration
Removes support for configuring GitHub, GitLab, Google, Okta, Keycloak, and Microsoft Entra ID identity providers via the deprecated AUTH_EE_*_CLIENT_ID/ SECRET/etc. environment variables. These providers must now be defined through the identityProviders section of the config file. GCP IAP env vars (AUTH_EE_GCP_IAP_ENABLED / AUTH_EE_GCP_IAP_AUDIENCE) are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent cfab0cf commit b19fa73

3 files changed

Lines changed: 6 additions & 187 deletions

File tree

packages/backend/src/ee/tokenRefresh.ts

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,9 @@ const refreshOAuthToken = async (
155155
const identityProviders = config?.identityProviders ?? [];
156156
const providerConfigs = identityProviders.filter(idp => idp.provider === provider);
157157

158-
// If no provider configs in the config file, try deprecated env vars.
158+
// No provider configs in the config file — nothing to refresh against.
159159
if (providerConfigs.length === 0) {
160-
const envCredentials = getDeprecatedEnvCredentials(provider);
161-
if (envCredentials) {
162-
logger.debug(`Using deprecated env vars for ${provider} token refresh`);
163-
const result = await tryRefreshToken(provider, refreshToken, envCredentials);
164-
if (result) {
165-
return result;
166-
}
167-
logger.error(`Failed to refresh ${provider} token using deprecated env credentials`);
168-
return null;
169-
}
170-
logger.error(`No provider config or env credentials found for: ${provider}`);
160+
logger.error(`No provider config found for: ${provider}`);
171161
return null;
172162
}
173163

@@ -291,26 +281,4 @@ const tryRefreshToken = async (
291281
}
292282

293283
return result.data;
294-
}
295-
296-
/**
297-
* Get credentials from deprecated environment variables.
298-
* This is for backwards compatibility with deployments using env vars instead of config file.
299-
*/
300-
const getDeprecatedEnvCredentials = (provider: string): ProviderCredentials | null => {
301-
if (provider === 'github' && env.AUTH_EE_GITHUB_CLIENT_ID && env.AUTH_EE_GITHUB_CLIENT_SECRET) {
302-
return {
303-
clientId: env.AUTH_EE_GITHUB_CLIENT_ID,
304-
clientSecret: env.AUTH_EE_GITHUB_CLIENT_SECRET,
305-
baseUrl: env.AUTH_EE_GITHUB_BASE_URL,
306-
};
307-
}
308-
if (provider === 'gitlab' && env.AUTH_EE_GITLAB_CLIENT_ID && env.AUTH_EE_GITLAB_CLIENT_SECRET) {
309-
return {
310-
clientId: env.AUTH_EE_GITLAB_CLIENT_ID,
311-
clientSecret: env.AUTH_EE_GITLAB_CLIENT_SECRET,
312-
baseUrl: env.AUTH_EE_GITLAB_BASE_URL,
313-
};
314-
}
315-
return null;
316284
}

packages/shared/src/env.server.ts

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -385,94 +385,6 @@ const options = {
385385
* ignored.
386386
*/
387387
SOURCEBOT_TELEMETRY_PII_COLLECTION_ENABLED: booleanSchema.default('false'),
388-
389-
//// DEPRECATED ////
390-
391-
/**
392-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
393-
*/
394-
AUTH_EE_GITHUB_CLIENT_ID: z.string().optional(),
395-
396-
/**
397-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
398-
*/
399-
AUTH_EE_GITHUB_CLIENT_SECRET: z.string().optional(),
400-
401-
/**
402-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
403-
*/
404-
AUTH_EE_GITHUB_BASE_URL: z.string().optional(),
405-
406-
/**
407-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
408-
*/
409-
AUTH_EE_GITLAB_CLIENT_ID: z.string().optional(),
410-
411-
/**
412-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
413-
*/
414-
AUTH_EE_GITLAB_CLIENT_SECRET: z.string().optional(),
415-
416-
/**
417-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
418-
*/
419-
AUTH_EE_GITLAB_BASE_URL: z.string().default("https://gitlab.com"),
420-
421-
/**
422-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
423-
*/
424-
AUTH_EE_GOOGLE_CLIENT_ID: z.string().optional(),
425-
426-
/**
427-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
428-
*/
429-
AUTH_EE_GOOGLE_CLIENT_SECRET: z.string().optional(),
430-
431-
/**
432-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
433-
*/
434-
AUTH_EE_OKTA_CLIENT_ID: z.string().optional(),
435-
436-
/**
437-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
438-
*/
439-
AUTH_EE_OKTA_CLIENT_SECRET: z.string().optional(),
440-
441-
/**
442-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
443-
*/
444-
AUTH_EE_OKTA_ISSUER: z.string().optional(),
445-
446-
/**
447-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
448-
*/
449-
AUTH_EE_KEYCLOAK_CLIENT_ID: z.string().optional(),
450-
451-
/**
452-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
453-
*/
454-
AUTH_EE_KEYCLOAK_CLIENT_SECRET: z.string().optional(),
455-
456-
/**
457-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
458-
*/
459-
AUTH_EE_KEYCLOAK_ISSUER: z.string().optional(),
460-
461-
/**
462-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
463-
*/
464-
AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_ID: z.string().optional(),
465-
466-
/**
467-
* @deprecated
468-
* This setting is deprecated. Please use the `identityProviders` section of the config file instead.
469-
*/
470-
AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_SECRET: z.string().optional(),
471-
472-
/**
473-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
474-
*/
475-
AUTH_EE_MICROSOFT_ENTRA_ID_ISSUER: z.string().optional(),
476388
},
477389
runtimeEnv,
478390
emptyStringAsUndefined: true,

packages/web/src/ee/features/sso/sso.ts

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -160,72 +160,11 @@ export const getEEIdentityProviders = async (): Promise<IdentityProvider[]> => {
160160
}
161161
}
162162

163-
// @deprecate in favor of defining identity providers throught the identityProvider object in the config file. This was done to allow for more control over
164-
// which identity providers are defined and their purpose. We've left this logic here to support backwards compat with deployments that expect these env vars,
165-
// but this logic will be removed in the future
166-
// We only go through this path if no identityProviders are defined in the config to prevent accidental duplication of providers
163+
// @deprecate GCP IAP is the only identity provider still configurable via env vars; every
164+
// other provider must be defined through the identityProviders object in the config file.
165+
// We only go through this path if no identityProviders are defined in the config to prevent
166+
// accidental duplication of providers.
167167
if (identityProviders.length == 0) {
168-
if (env.AUTH_EE_GITHUB_CLIENT_ID && env.AUTH_EE_GITHUB_CLIENT_SECRET) {
169-
const baseUrl = (env.AUTH_EE_GITHUB_BASE_URL ?? 'https://github.com').replace(/\/+$/, '');
170-
providers.push({
171-
provider: await createGitHubProvider(
172-
env.AUTH_EE_GITHUB_CLIENT_ID,
173-
env.AUTH_EE_GITHUB_CLIENT_SECRET,
174-
baseUrl
175-
),
176-
purpose: "sso",
177-
issuerUrl: baseUrl
178-
});
179-
}
180-
181-
if (env.AUTH_EE_GITLAB_CLIENT_ID && env.AUTH_EE_GITLAB_CLIENT_SECRET) {
182-
const baseUrl = (env.AUTH_EE_GITLAB_BASE_URL ?? 'https://gitlab.com').replace(/\/+$/, '');
183-
providers.push({
184-
provider: await createGitLabProvider(
185-
env.AUTH_EE_GITLAB_CLIENT_ID,
186-
env.AUTH_EE_GITLAB_CLIENT_SECRET,
187-
baseUrl,
188-
),
189-
purpose: "sso",
190-
issuerUrl: baseUrl
191-
});
192-
}
193-
194-
if (env.AUTH_EE_GOOGLE_CLIENT_ID && env.AUTH_EE_GOOGLE_CLIENT_SECRET) {
195-
providers.push({
196-
provider: createGoogleProvider(env.AUTH_EE_GOOGLE_CLIENT_ID, env.AUTH_EE_GOOGLE_CLIENT_SECRET),
197-
purpose: "sso",
198-
issuerUrl: 'https://accounts.google.com'
199-
});
200-
}
201-
202-
if (env.AUTH_EE_OKTA_CLIENT_ID && env.AUTH_EE_OKTA_CLIENT_SECRET && env.AUTH_EE_OKTA_ISSUER) {
203-
const issuer = env.AUTH_EE_OKTA_ISSUER.replace(/\/+$/, '');
204-
providers.push({
205-
provider: createOktaProvider(env.AUTH_EE_OKTA_CLIENT_ID, env.AUTH_EE_OKTA_CLIENT_SECRET, issuer),
206-
purpose: "sso",
207-
issuerUrl: issuer
208-
});
209-
}
210-
211-
if (env.AUTH_EE_KEYCLOAK_CLIENT_ID && env.AUTH_EE_KEYCLOAK_CLIENT_SECRET && env.AUTH_EE_KEYCLOAK_ISSUER) {
212-
const issuer = env.AUTH_EE_KEYCLOAK_ISSUER.replace(/\/+$/, '');
213-
providers.push({
214-
provider: createKeycloakProvider(env.AUTH_EE_KEYCLOAK_CLIENT_ID, env.AUTH_EE_KEYCLOAK_CLIENT_SECRET, issuer),
215-
purpose: "sso",
216-
issuerUrl: issuer
217-
});
218-
}
219-
220-
if (env.AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_ID && env.AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_SECRET && env.AUTH_EE_MICROSOFT_ENTRA_ID_ISSUER) {
221-
const issuer = env.AUTH_EE_MICROSOFT_ENTRA_ID_ISSUER.replace(/\/+$/, '');
222-
providers.push({
223-
provider: createMicrosoftEntraIDProvider(env.AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_ID, env.AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_SECRET, issuer),
224-
purpose: "sso",
225-
issuerUrl: issuer
226-
});
227-
}
228-
229168
if (env.AUTH_EE_GCP_IAP_ENABLED && env.AUTH_EE_GCP_IAP_AUDIENCE) {
230169
providers.push({
231170
provider: createGCPIAPProvider(env.AUTH_EE_GCP_IAP_AUDIENCE),

0 commit comments

Comments
 (0)