Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fixed merge conflicts
x1b3e8b0a1c06
diff --cc backend/src/server/routes/v1/sso-router.tsindex 3731a7aa0c,09d7cb5bd6..d8e1ae5435--- a/backend/src/server/routes/v1/sso-router.ts+++ b/backend/src/server/routes/v1/sso-router.ts@@@ -9,15 -9,17 +9,17 @@@import { Authenticator } from "@fastify/passport";import fastifySession from "@fastify/session";import RedisStore from "connect-redis";-import { Strategy as GitHubStrategy } from "passport-github";import { Strategy as GitLabStrategy } from "passport-gitlab2";import { Strategy as GoogleStrategy } from "passport-google-oauth20";+import { Strategy as OAuth2Strategy } from "passport-oauth2";import { z } from "zod";+ import { INFISICAL_PROVIDER_GITHUB_ACCESS_TOKEN } from "@app/lib/config/const";import { getConfig } from "@app/lib/config/env";import { BadRequestError, NotFoundError } from "@app/lib/errors";import { logger } from "@app/lib/logger";+ import { ms } from "@app/lib/ms";-import { fetchGithubEmails } from "@app/lib/requests/github";+import { fetchGithubEmails, fetchGithubUser } from "@app/lib/requests/github";import { authRateLimit } from "@app/server/config/rateLimiter";import { AuthMethod } from "@app/services/auth/auth-type";import { OrgAuthMethod } from "@app/services/org/org-types";@@@ -91,21 -91,20 +93,21 @@@ export const registerSsoRouter = asyncconst isGithubOauthActive = Boolean(appCfg.CLIENT_SECRET_GITHUB_LOGIN && appCfg.CLIENT_ID_GITHUB_LOGIN);if (isGithubOauthActive) {passport.use(- new GitHubStrategy(+ "github",+ new OAuth2Strategy({- passReqToCallback: true,- clientID: appCfg.CLIENT_ID_GITHUB_LOGIN as string,- clientSecret: appCfg.CLIENT_SECRET_GITHUB_LOGIN as string,+ authorizationURL: "https://github.com/login/oauth/authorize",+ tokenURL: "https://github.com/login/oauth/access_token",+ clientID: appCfg.CLIENT_ID_GITHUB_LOGIN!,+ clientSecret: appCfg.CLIENT_SECRET_GITHUB_LOGIN!,callbackURL: `${appCfg.SITE_URL}/api/v1/sso/github`,- scope: ["user:email"],+ scope: ["user:email", "read:org"],- // akhilmhdh: because the ts type for this is outdated by the maintainer- state: true as unknown as string+ state: true,+ pkce: true,+ passReqToCallback: true},// eslint-disable-next-line- async (req, accessToken, _refreshToken, profile, cb) => {- // @ts-expect-error this is because this is express type and not fastify- const callbackPort = req.session.get("callbackPort");+ async (req: any, accessToken: string, _refreshToken: string, _profile: any, done: Function) => {try {const ghEmails = await fetchGithubEmails(accessToken);const { email } = ghEmails.filter((gitHubEmail) => gitHubEmail.primary)[0];@@@ -124,11 -115,10 +126,11 @@@authMethod: AuthMethod.GITHUB,callbackPort});- return cb(null, { isUserCompleted, providerAuthToken, externalProviderAccessToken: accessToken });- } catch (error) {- logger.error(error);- cb(error as Error, false);+- done(null, { isUserCompleted, providerAuthToken });++ done(null, { isUserCompleted, providerAuthToken, externalProviderAccessToken: accessToken });+ } catch (err) {+ logger.error(err);+ done(err as Error, false);}})