🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: github oauth should check issuer (#13115)
Valery Meleshkinff97a3b41336
diff --git a/web/src/ee/features/multi-tenant-sso/utils.ts b/web/src/ee/features/multi-tenant-sso/utils.tsindex b344e24de5..28b8c54e7e 100644--- a/web/src/ee/features/multi-tenant-sso/utils.ts+++ b/web/src/ee/features/multi-tenant-sso/utils.ts@@ -188,6 +188,7 @@ const dbToNextAuthProvider = (provider: SsoProviderSchema): Provider | null => {id: getAuthProviderIdForSsoConfig(provider), // use the domain as the provider id as we use domain-specific credentials...provider.authConfig,clientSecret: decrypt(provider.authConfig.clientSecret),+ issuer: "https://github.com/login/oauth",...getClientConfig(provider.authConfig),});else if (provider.authProvider === "gitlab")@@ -264,6 +265,8 @@ const dbToNextAuthProvider = (provider: SsoProviderSchema): Provider | null => {enterprise: {baseUrl: provider.authConfig.enterprise.baseUrl,},+ issuer: new URL("/login/oauth", provider.authConfig.enterprise.baseUrl)+ .href,...getClientConfig(provider.authConfig),});else if (provider.authProvider === "jumpcloud")diff --git a/web/src/env.mjs b/web/src/env.mjsindex d0cc51e0d2..afcea741e1 100644--- a/web/src/env.mjs+++ b/web/src/env.mjs@@ -106,7 +106,7 @@ export const env = createEnv({AUTH_GITHUB_CHECKS: zAuthChecks,AUTH_GITHUB_ENTERPRISE_CLIENT_ID: z.string().optional(),AUTH_GITHUB_ENTERPRISE_CLIENT_SECRET: z.string().optional(),- AUTH_GITHUB_ENTERPRISE_BASE_URL: z.string().optional(),+ AUTH_GITHUB_ENTERPRISE_BASE_URL: z.string().url().optional(),AUTH_GITHUB_ENTERPRISE_ALLOW_ACCOUNT_LINKING: z.enum(["true", "false"]).optional(),diff --git a/web/src/server/auth.ts b/web/src/server/auth.tsindex 207cdabb88..f5ff2977f4 100644--- a/web/src/server/auth.ts+++ b/web/src/server/auth.ts@@ -353,6 +353,10 @@ if (env.AUTH_GITHUB_CLIENT_ID && env.AUTH_GITHUB_CLIENT_SECRET)GitHubProvider({clientId: env.AUTH_GITHUB_CLIENT_ID,clientSecret: env.AUTH_GITHUB_CLIENT_SECRET,+ // Required for RFC 9207: GitHub now sends iss in OAuth callbacks+ // TODO perhaps add "https://github.com/login/oauth/.well-known/openid-configuration"+ // when github starts providing userinfo+ issuer: "https://github.com/login/oauth",allowDangerousEmailAccountLinking:env.AUTH_GITHUB_ALLOW_ACCOUNT_LINKING === "true",client: {@@ -372,6 +376,7 @@ if (clientId: env.AUTH_GITHUB_ENTERPRISE_CLIENT_ID,clientSecret: env.AUTH_GITHUB_ENTERPRISE_CLIENT_SECRET,enterprise: { baseUrl: env.AUTH_GITHUB_ENTERPRISE_BASE_URL },+ issuer: new URL("/login/oauth", env.AUTH_GITHUB_ENTERPRISE_BASE_URL).href,allowDangerousEmailAccountLinking:env.AUTH_GITHUB_ENTERPRISE_ALLOW_ACCOUNT_LINKING === "true",client: {