Skip to content

Commit 97666d0

Browse files
Merge branch 'main' into bkellam/multi-idp
2 parents 501abec + d2843aa commit 97666d0

5 files changed

Lines changed: 66 additions & 204 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- Removed support for configuring the GitHub, GitLab, Google, Okta, Keycloak, and Microsoft Entra ID identity providers via the deprecated `AUTH_EE_*` environment variables. See the [v5 migration guide](http://docs.sourcebot.dev/docs/upgrade/v4-to-v5-guide#identity-providers-must-be-configured-via-the-config-file) for more details. [#1297](https://github.com/sourcebot-dev/sourcebot/pull/1297)
12+
- Anthropic thinking mode (adaptive vs. extended) is now resolved from the model's capabilities via the Anthropic Models API instead of a hardcoded model list. [#1294](https://github.com/sourcebot-dev/sourcebot/pull/1294)
13+
1014
### Added
1115
- [EE] Added prompt caching for Ask Sourcebot. For Anthropic models, the static prompt prefix (tool definitions, system prompt, and conversation history) is marked with a cache breakpoint so it is billed at the provider's discounted cache-read rate on subsequent agent steps and follow-up turns. Toggle with `SOURCEBOT_CHAT_PROMPT_CACHING_ENABLED` (default `true`). [#1278](https://github.com/sourcebot-dev/sourcebot/pull/1278)
1216
- [EE] Added a cached-token breakdown to the Ask Sourcebot message details, showing what share of the input tokens were served from the model provider's prompt cache. [#1278](https://github.com/sourcebot-dev/sourcebot/pull/1278)
1317
- Added `isLanguageModelConfigured` to the service ping, indicating whether at least one language model is configured. [#1296](https://github.com/sourcebot-dev/sourcebot/pull/1296)
1418

15-
### Changed
16-
- Anthropic thinking mode (adaptive vs. extended) is now resolved from the model's capabilities via the Anthropic Models API instead of a hardcoded model list. [#1294](https://github.com/sourcebot-dev/sourcebot/pull/1294)
17-
1819
### Fixed
1920
- Upgraded `protobufjs` to `^7.6.2`. [#1281](https://github.com/sourcebot-dev/sourcebot/pull/1281)
2021
- Upgraded `picomatch` to `^4.0.4`. [#1283](https://github.com/sourcebot-dev/sourcebot/pull/1283)

docs/docs/upgrade/v4-to-v5-guide.mdx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,67 @@ docker exec sourcebot rm /data/.sourcebot/.secret /data/.sourcebot/.authjs-secre
176176
Sourcebot warns at startup if either file is still present.
177177
</Expandable>
178178

179+
### Identity providers must be configured via the config file
180+
<Note>
181+
**Who's affected:** Deployments that configure GitHub, GitLab, Google, Okta, Keycloak, or Microsoft Entra ID single sign-on through the deprecated `AUTH_EE_*` environment variables. Deployments that already define these providers in the [`identityProviders`](/docs/configuration/idp) config file section are not affected.
182+
</Note>
183+
184+
#### Description
185+
186+
In v4, you could configure these identity providers using `AUTH_EE_*` environment variables (for example `AUTH_EE_GITHUB_CLIENT_ID`). Those variables were deprecated in favor of the [`identityProviders`](/docs/configuration/idp) section of the config file. Starting in v5.0.2, the environment variable path has been removed. Sourcebot no longer reads these variables, and any provider configured only through them will stop appearing on the login screen. This also applies if you are upgrading from an earlier v5 release (v5.0.0 or v5.0.1), where these variables were still supported.
187+
188+
The following environment variables are no longer read:
189+
190+
| Provider | Removed environment variables |
191+
| :------- | :---------------------------- |
192+
| GitHub | `AUTH_EE_GITHUB_CLIENT_ID`, `AUTH_EE_GITHUB_CLIENT_SECRET`, `AUTH_EE_GITHUB_BASE_URL` |
193+
| GitLab | `AUTH_EE_GITLAB_CLIENT_ID`, `AUTH_EE_GITLAB_CLIENT_SECRET`, `AUTH_EE_GITLAB_BASE_URL` |
194+
| Google | `AUTH_EE_GOOGLE_CLIENT_ID`, `AUTH_EE_GOOGLE_CLIENT_SECRET` |
195+
| Okta | `AUTH_EE_OKTA_CLIENT_ID`, `AUTH_EE_OKTA_CLIENT_SECRET`, `AUTH_EE_OKTA_ISSUER` |
196+
| Keycloak | `AUTH_EE_KEYCLOAK_CLIENT_ID`, `AUTH_EE_KEYCLOAK_CLIENT_SECRET`, `AUTH_EE_KEYCLOAK_ISSUER` |
197+
| Microsoft Entra ID | `AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_ID`, `AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_SECRET`, `AUTH_EE_MICROSOFT_ENTRA_ID_ISSUER` |
198+
199+
#### Action Items
200+
201+
<Expandable title="Migrating to the config file">
202+
<br/>
203+
204+
Move each affected provider into the `identityProviders` array in your [config file](/docs/configuration/config-file). You don't need to rotate any secrets. Reference your existing environment variable values from the config using [tokens](/docs/configuration/config-file#tokens), keeping the same variable names if you like.
205+
206+
For example, a GitHub provider previously configured with environment variables:
207+
208+
```bash wrap icon="terminal"
209+
AUTH_EE_GITHUB_CLIENT_ID='your-client-id'
210+
AUTH_EE_GITHUB_CLIENT_SECRET='your-client-secret'
211+
```
212+
213+
becomes the following in the config file:
214+
215+
```json wrap icon="code"
216+
{
217+
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
218+
"identityProviders": [
219+
{
220+
"provider": "github",
221+
"purpose": "sso",
222+
"clientId": {
223+
"env": "AUTH_EE_GITHUB_CLIENT_ID"
224+
},
225+
"clientSecret": {
226+
"env": "AUTH_EE_GITHUB_CLIENT_SECRET"
227+
}
228+
}
229+
]
230+
}
231+
```
232+
233+
<Note>
234+
Set `purpose` to `sso` to keep the provider usable for login. For providers that take an issuer (Okta, Keycloak, Microsoft Entra ID), add an `issuer` token. For self-hosted GitHub or GitLab, add a `baseUrl` string (this replaces `AUTH_EE_GITHUB_BASE_URL` and `AUTH_EE_GITLAB_BASE_URL`).
235+
</Note>
236+
237+
See the [external identity providers](/docs/configuration/idp) docs for the full per-provider config reference.
238+
</Expandable>
239+
179240

180241
## Upgrading
181242

packages/backend/src/ee/tokenRefresh.ts

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,8 @@ const refreshOAuthToken = async (
162162
config.identityProviders[providerId] :
163163
undefined;
164164

165-
// If no provider configs in the config file, try deprecated env vars.
166165
if (!idpConfig) {
167-
const envCredentials = getDeprecatedEnvCredentials(providerType);
168-
if (envCredentials) {
169-
logger.debug(`Using deprecated env vars for ${providerType} token refresh`);
170-
const result = await tryRefreshToken(providerType, refreshToken, envCredentials);
171-
if (result) {
172-
return result;
173-
}
174-
logger.error(`Failed to refresh ${providerType} token using deprecated env credentials`);
175-
return null;
176-
}
177-
logger.error(`No provider config or env credentials found for: ${providerType}`);
166+
logger.error(`No provider config found for: ${providerId}`);
178167
return null;
179168
}
180169

@@ -284,26 +273,4 @@ const tryRefreshToken = async (
284273
}
285274

286275
return result.data;
287-
}
288-
289-
/**
290-
* Get credentials from deprecated environment variables.
291-
* This is for backwards compatibility with deployments using env vars instead of config file.
292-
*/
293-
const getDeprecatedEnvCredentials = (providerType: string): ProviderCredentials | null => {
294-
if (providerType === 'github' && env.AUTH_EE_GITHUB_CLIENT_ID && env.AUTH_EE_GITHUB_CLIENT_SECRET) {
295-
return {
296-
clientId: env.AUTH_EE_GITHUB_CLIENT_ID,
297-
clientSecret: env.AUTH_EE_GITHUB_CLIENT_SECRET,
298-
baseUrl: env.AUTH_EE_GITHUB_BASE_URL,
299-
};
300-
}
301-
if (providerType === 'gitlab' && env.AUTH_EE_GITLAB_CLIENT_ID && env.AUTH_EE_GITLAB_CLIENT_SECRET) {
302-
return {
303-
clientId: env.AUTH_EE_GITLAB_CLIENT_ID,
304-
clientSecret: env.AUTH_EE_GITLAB_CLIENT_SECRET,
305-
baseUrl: env.AUTH_EE_GITLAB_BASE_URL,
306-
};
307-
}
308-
return null;
309276
}

packages/shared/src/env.server.ts

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -426,94 +426,6 @@ const options = {
426426
* ignored.
427427
*/
428428
SOURCEBOT_TELEMETRY_PII_COLLECTION_ENABLED: booleanSchema.default('false'),
429-
430-
//// DEPRECATED ////
431-
432-
/**
433-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
434-
*/
435-
AUTH_EE_GITHUB_CLIENT_ID: z.string().optional(),
436-
437-
/**
438-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
439-
*/
440-
AUTH_EE_GITHUB_CLIENT_SECRET: z.string().optional(),
441-
442-
/**
443-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
444-
*/
445-
AUTH_EE_GITHUB_BASE_URL: z.string().optional(),
446-
447-
/**
448-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
449-
*/
450-
AUTH_EE_GITLAB_CLIENT_ID: z.string().optional(),
451-
452-
/**
453-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
454-
*/
455-
AUTH_EE_GITLAB_CLIENT_SECRET: z.string().optional(),
456-
457-
/**
458-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
459-
*/
460-
AUTH_EE_GITLAB_BASE_URL: z.string().default("https://gitlab.com"),
461-
462-
/**
463-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
464-
*/
465-
AUTH_EE_GOOGLE_CLIENT_ID: z.string().optional(),
466-
467-
/**
468-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
469-
*/
470-
AUTH_EE_GOOGLE_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_OKTA_CLIENT_ID: z.string().optional(),
476-
477-
/**
478-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
479-
*/
480-
AUTH_EE_OKTA_CLIENT_SECRET: z.string().optional(),
481-
482-
/**
483-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
484-
*/
485-
AUTH_EE_OKTA_ISSUER: z.string().optional(),
486-
487-
/**
488-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
489-
*/
490-
AUTH_EE_KEYCLOAK_CLIENT_ID: z.string().optional(),
491-
492-
/**
493-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
494-
*/
495-
AUTH_EE_KEYCLOAK_CLIENT_SECRET: z.string().optional(),
496-
497-
/**
498-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
499-
*/
500-
AUTH_EE_KEYCLOAK_ISSUER: z.string().optional(),
501-
502-
/**
503-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
504-
*/
505-
AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_ID: z.string().optional(),
506-
507-
/**
508-
* @deprecated
509-
* This setting is deprecated. Please use the `identityProviders` section of the config file instead.
510-
*/
511-
AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_SECRET: z.string().optional(),
512-
513-
/**
514-
* @deprecated This setting is deprecated. Please use the `identityProviders` section of the config file instead.
515-
*/
516-
AUTH_EE_MICROSOFT_ENTRA_ID_ISSUER: z.string().optional(),
517429
},
518430
runtimeEnv,
519431
emptyStringAsUndefined: true,

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

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -191,86 +191,7 @@ export const getEEIdentityProviders = async (): Promise<IdentityProvider[]> => {
191191
}
192192
}
193193

194-
// @deprecate in favor of defining identity providers throught the identityProvider object in the config file. This was done to allow for more control over
195-
// 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,
196-
// but this logic will be removed in the future
197-
// We only go through this path if no identityProviders are defined in the config to prevent accidental duplication of providers
198194
if (Object.keys(identityProviders).length === 0) {
199-
if (env.AUTH_EE_GITHUB_CLIENT_ID && env.AUTH_EE_GITHUB_CLIENT_SECRET) {
200-
const baseUrl = (env.AUTH_EE_GITHUB_BASE_URL ?? 'https://github.com').replace(/\/+$/, '');
201-
providers.push({
202-
__provider: await createGitHubProvider(
203-
'github',
204-
env.AUTH_EE_GITHUB_CLIENT_ID,
205-
env.AUTH_EE_GITHUB_CLIENT_SECRET,
206-
baseUrl
207-
),
208-
type: "github",
209-
id: "github",
210-
purpose: "sso",
211-
issuerUrl: baseUrl
212-
});
213-
}
214-
215-
if (env.AUTH_EE_GITLAB_CLIENT_ID && env.AUTH_EE_GITLAB_CLIENT_SECRET) {
216-
const baseUrl = (env.AUTH_EE_GITLAB_BASE_URL ?? 'https://gitlab.com').replace(/\/+$/, '');
217-
providers.push({
218-
__provider: await createGitLabProvider(
219-
'gitlab',
220-
env.AUTH_EE_GITLAB_CLIENT_ID,
221-
env.AUTH_EE_GITLAB_CLIENT_SECRET,
222-
baseUrl,
223-
),
224-
type: "gitlab",
225-
id: "gitlab",
226-
purpose: "sso",
227-
issuerUrl: baseUrl
228-
});
229-
}
230-
231-
if (env.AUTH_EE_GOOGLE_CLIENT_ID && env.AUTH_EE_GOOGLE_CLIENT_SECRET) {
232-
providers.push({
233-
__provider: createGoogleProvider('google', env.AUTH_EE_GOOGLE_CLIENT_ID, env.AUTH_EE_GOOGLE_CLIENT_SECRET),
234-
type: "google",
235-
id: "google",
236-
purpose: "sso",
237-
issuerUrl: 'https://accounts.google.com'
238-
});
239-
}
240-
241-
if (env.AUTH_EE_OKTA_CLIENT_ID && env.AUTH_EE_OKTA_CLIENT_SECRET && env.AUTH_EE_OKTA_ISSUER) {
242-
const issuer = env.AUTH_EE_OKTA_ISSUER.replace(/\/+$/, '');
243-
providers.push({
244-
__provider: createOktaProvider('okta', env.AUTH_EE_OKTA_CLIENT_ID, env.AUTH_EE_OKTA_CLIENT_SECRET, issuer),
245-
type: "okta",
246-
id: "okta",
247-
purpose: "sso",
248-
issuerUrl: issuer
249-
});
250-
}
251-
252-
if (env.AUTH_EE_KEYCLOAK_CLIENT_ID && env.AUTH_EE_KEYCLOAK_CLIENT_SECRET && env.AUTH_EE_KEYCLOAK_ISSUER) {
253-
const issuer = env.AUTH_EE_KEYCLOAK_ISSUER.replace(/\/+$/, '');
254-
providers.push({
255-
__provider: createKeycloakProvider('keycloak', env.AUTH_EE_KEYCLOAK_CLIENT_ID, env.AUTH_EE_KEYCLOAK_CLIENT_SECRET, issuer),
256-
type: "keycloak",
257-
id: "keycloak",
258-
purpose: "sso",
259-
issuerUrl: issuer
260-
});
261-
}
262-
263-
if (env.AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_ID && env.AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_SECRET && env.AUTH_EE_MICROSOFT_ENTRA_ID_ISSUER) {
264-
const issuer = env.AUTH_EE_MICROSOFT_ENTRA_ID_ISSUER.replace(/\/+$/, '');
265-
providers.push({
266-
__provider: createMicrosoftEntraIDProvider('microsoft-entra-id', env.AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_ID, env.AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_SECRET, issuer),
267-
type: "microsoft-entra-id",
268-
id: "microsoft-entra-id",
269-
purpose: "sso",
270-
issuerUrl: issuer
271-
});
272-
}
273-
274195
if (env.AUTH_EE_GCP_IAP_ENABLED && env.AUTH_EE_GCP_IAP_AUDIENCE) {
275196
providers.push({
276197
__provider: createGCPIAPProvider('gcp-iap', env.AUTH_EE_GCP_IAP_AUDIENCE),

0 commit comments

Comments
 (0)