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
feat: add pam session gating
Sheen Capadngan019a57151fc7
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.tsindex 50b77bc4ee..a9900c12fb 100644--- a/backend/src/@types/fastify.d.ts+++ b/backend/src/@types/fastify.d.ts@@ -96,6 +96,7 @@ import { TIntegrationAuthServiceFactory } from "@app/services/integration-auth/iimport { TMembershipGroupServiceFactory } from "@app/services/membership-group/membership-group-service";import { TMembershipIdentityServiceFactory } from "@app/services/membership-identity/membership-identity-service";import { TMembershipUserServiceFactory } from "@app/services/membership-user/membership-user-service";+import { TMfaSessionServiceFactory } from "@app/services/mfa-session/mfa-session-service";import { TMicrosoftTeamsServiceFactory } from "@app/services/microsoft-teams/microsoft-teams-service";import { TNotificationServiceFactory } from "@app/services/notification/notification-service";import { TOfflineUsageReportServiceFactory } from "@app/services/offline-usage-report/offline-usage-report-service";@@ -349,6 +350,7 @@ declare module "fastify" {pamResource: TPamResourceServiceFactory;pamAccount: TPamAccountServiceFactory;pamSession: TPamSessionServiceFactory;+ mfaSession: TMfaSessionServiceFactory;upgradePath: TUpgradePathService;membershipUser: TMembershipUserServiceFactory;diff --git a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.tsindex c28770be4e..1d545578e6 100644--- a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts+++ b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts@@ -68,6 +68,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {description: "Access PAM account",body: z.object({accountId: z.string().uuid(),+ mfaSessionId: z.string().optional(),duration: z.string().min(1)diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex b6f2bbae92..25b8d6c073 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -9,14 +9,21 @@ import {ProjectPermissionPamAccountActions,ProjectPermissionSub} from "@app/ee/services/permission/project-permission";+import { KeyStorePrefixes, KeyStoreTtls, TKeyStoreFactory } from "@app/keystore/keystore";+import { crypto } from "@app/lib/crypto";import { DatabaseErrorCode } from "@app/lib/error-codes";import { BadRequestError, DatabaseError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";import { logger } from "@app/lib/logger";import { OrgServiceActor } from "@app/lib/types";-import { ActorType } from "@app/services/auth/auth-type";+import { ActorType, MfaMethod } from "@app/services/auth/auth-type";+import { TAuthTokenServiceFactory } from "@app/services/auth-token/auth-token-service";+import { TokenType } from "@app/services/auth-token/auth-token-types";import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { KmsDataKey } from "@app/services/kms/kms-types";+import { MfaSessionStatus, TMfaSession } from "@app/services/mfa-session/mfa-session-types";+import { TOrgDALFactory } from "@app/services/org/org-dal";import { TProjectDALFactory } from "@app/services/project/project-dal";+import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";import { TUserDALFactory } from "@app/services/user/user-dal";import { EventType, TAuditLogServiceFactory } from "../audit-log/audit-log-types";@@ -42,6 +49,7 @@ type TPamAccountServiceFactoryDep = {pamAccountDAL: TPamAccountDALFactory;pamFolderDAL: TPamFolderDALFactory;projectDAL: TProjectDALFactory;+ orgDAL: TOrgDALFactory;permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getOrgPermission">;licenseService: Pick<TLicenseServiceFactory, "getPlan">;kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;@@ -51,6 +59,9 @@ type TPamAccountServiceFactoryDep = {>;userDAL: TUserDALFactory;auditLogService: Pick<TAuditLogServiceFactory, "createAuditLog">;+ keyStore: Pick<TKeyStoreFactory, "setItemWithExpiry" | "getItem" | "deleteItem">;+ tokenService: Pick<TAuthTokenServiceFactory, "createTokenForUser" | "validateTokenForUser">;+ smtpService: Pick<TSmtpService, "sendMail">;};export type TPamAccountServiceFactory = ReturnType<typeof pamAccountServiceFactory>;@@ -62,13 +73,53 @@ export const pamAccountServiceFactory = ({pamAccountDAL,pamFolderDAL,projectDAL,+ orgDAL,userDAL,permissionService,licenseService,kmsService,gatewayV2Service,- auditLogService+ auditLogService,+ keyStore,+ tokenService,+ smtpService}: TPamAccountServiceFactoryDep) => {+ const createMfaSession = async (userId: string, accountId: string, mfaMethod: MfaMethod): Promise<string> => {+ const mfaSessionId = crypto.randomBytes(32).toString("hex");+ const mfaSession: TMfaSession = {+ sessionId: mfaSessionId,+ userId,+ resourceId: accountId,+ status: MfaSessionStatus.PENDING,+ mfaMethod+ };++ await keyStore.setItemWithExpiry(+ KeyStorePrefixes.MfaSession(mfaSessionId),+ KeyStoreTtls.MfaSessionInSeconds,+ JSON.stringify(mfaSession)+ );++ return mfaSessionId;+ };++ // Helper function to send MFA code via email+ const sendMfaCode = async (userId: string, email: string) => {+ const code = await tokenService.createTokenForUser({+ type: TokenType.TOKEN_EMAIL_MFA,+ userId+ });++ await smtpService.sendMail({+ template: SmtpTemplates.EmailMfa,+ subjectLine: "Infisical PAM Access MFA code",+ recipients: [email],+ substitutions: {+ code+ }+ });+ };+const create = async ({credentials,@@ -400,7 +451,7 @@ export const pamAccountServiceFactory = ({};const access = async (- { accountId, actorEmail, actorIp, actorName, actorUserAgent, duration }: TAccessAccountDTO,+ { accountId, actorEmail, actorIp, actorName, actorUserAgent, duration, mfaSessionId }: TAccessAccountDTO,actor: OrgServiceActor) => {const orgLicensePlan = await licenseService.getPlan(actor.orgId);@@ -416,6 +467,9 @@ export const pamAccountServiceFactory = ({const resource = await pamResourceDAL.findById(account.resourceId);if (!resource) throw new NotFoundError({ message: `Resource with ID '${account.resourceId}' not found` });+ const project = await projectDAL.findById(account.projectId);+ if (!project) throw new NotFoundError({ message: `Project with ID '${account.projectId}' not found` });+const { permission } = await permissionService.getProjectPermission({actor: actor.type,actorAuthMethod: actor.authMethod,@@ -440,6 +494,82 @@ export const pamAccountServiceFactory = ({}));+ // MFA is required for all PAM account access (as per user requirement)+ // Get user to check MFA configuration+ const actorUser = await userDAL.findById(actor.id);+ if (!actorUser) throw new NotFoundError({ message: `User with ID '${actor.id}' not found` });++ // If no mfaSessionId is provided, create a new MFA session+ if (!mfaSessionId) {+ // Get organization to check if MFA is enforced at org level+ const org = await orgDAL.findOrgById(project.orgId);+ if (!org) throw new NotFoundError({ message: `Organization with ID '${project.orgId}' not found` });++ // Determine which MFA method to use+ // Priority: org-enforced > user-selected > email as fallback+ const orgMfaMethod = org.enforceMfa+ ? ((org.selectedMfaMethod as MfaMethod | null) ?? MfaMethod.EMAIL)+ : undefined;+ const userMfaMethod = actorUser.isMfaEnabled+ ? ((actorUser.selectedMfaMethod as MfaMethod | null) ?? MfaMethod.EMAIL)+ : undefined;+ const mfaMethod = (orgMfaMethod ?? userMfaMethod ?? MfaMethod.EMAIL) as MfaMethod;++ // Create MFA session+ const newMfaSessionId = await createMfaSession(actorUser.id, accountId, mfaMethod);++ // If MFA method is email, send the code immediately+ if (mfaMethod === MfaMethod.EMAIL && actorUser.email) {+ await sendMfaCode(actorUser.id, actorUser.email);+ }++ // Throw an error with the mfaSessionId to signal that MFA is required+ throw new BadRequestError({+ message: "MFA verification required to access PAM account",+ name: "SESSION_MFA_REQUIRED",+ details: {+ mfaSessionId: newMfaSessionId,+ mfaMethod+ }+ });+ }++ // If mfaSessionId is provided, verify it+ const mfaSessionKey = KeyStorePrefixes.MfaSession(mfaSessionId);+ const mfaSessionData = await keyStore.getItem(mfaSessionKey);++ if (!mfaSessionData) {+ throw new BadRequestError({+ message: "MFA session not found or expired"+ });+ }++ const mfaSession = JSON.parse(mfaSessionData) as TMfaSession;++ // Verify the session belongs to the current user+ if (mfaSession.userId !== actor.id) {+ throw new ForbiddenRequestError({+ message: "MFA session does not belong to current user"+ });+ }++ // Verify the session is for the same account+ if (mfaSession.resourceId !== accountId) {+ throw new BadRequestError({+ message: "MFA session is for a different resource"+ });+ }++ // Check if MFA session is active+ if (mfaSession.status !== MfaSessionStatus.ACTIVE) {+ throw new BadRequestError({+ message: "MFA session is not active. Please complete MFA verification first."+ });+ }++ // MFA verified successfully, delete the session and proceed with access+ await keyStore.deleteItem(mfaSessionKey);+const session = await pamSessionDAL.create({accountName: account.name,actorEmail,@@ -461,9 +591,6 @@ export const pamAccountServiceFactory = ({kmsService);- const user = await userDAL.findById(actor.id);- if (!user) throw new NotFoundError({ message: `User with ID '${actor.id}' not found` });-const gatewayConnectionDetails = await gatewayV2Service.getPAMConnectionDetails({gatewayId,duration,@@ -474,7 +601,7 @@ export const pamAccountServiceFactory = ({actorMetadata: {id: actor.id,type: actor.type,- name: user.email ?? ""+ name: actorUser.email ?? ""}});diff --git a/backend/src/ee/services/pam-account/pam-account-types.ts b/backend/src/ee/services/pam-account/pam-account-types.tsindex 4bbccc6faf..78a45d90c6 100644--- a/backend/src/ee/services/pam-account/pam-account-types.ts+++ b/backend/src/ee/services/pam-account/pam-account-types.ts@@ -17,4 +17,5 @@ export type TAccessAccountDTO = {actorName: string;actorUserAgent: string;duration: number;+ mfaSessionId?: string;};diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.tsindex 204952a92d..f374a1469d 100644--- a/backend/src/keystore/keystore.ts+++ b/backend/src/keystore/keystore.ts@@ -79,7 +79,9 @@ export const KeyStorePrefixes = {GroupMemberProjectPermissionPattern: (projectId: string, groupId: string) =>`group-member-project-permission:${projectId}:${groupId}:*` as const,- PkiAcmeNonce: (nonce: string) => `pki-acme-nonce:${nonce}` as const+ PkiAcmeNonce: (nonce: string) => `pki-acme-nonce:${nonce}` as const,+ MfaSession: (mfaSessionId: string) => `mfa-session:${mfaSessionId}` as const,+ WebAuthnChallenge: (userId: string) => `webauthn-challenge:${userId}` as const};export const KeyStoreTtls = {@@ -87,7 +89,9 @@ export const KeyStoreTtls = {SetSecretSyncLastRunTimestampInSeconds: 60,AccessTokenStatusUpdateInSeconds: 120,ProjectPermissionCacheInSeconds: 300, // 5 minutes- ProjectPermissionDalVersionTtl: "15m" // Project permission DAL version TTL+ ProjectPermissionDalVersionTtl: "15m", // Project permission DAL version TTL+ MfaSessionInSeconds: 300, // 5 minutes+ WebAuthnChallengeInSeconds: 300 // 5 minutes};type TDeleteItems = {diff --git a/backend/src/lib/errors/index.ts b/backend/src/lib/errors/index.tsindex dab9d32780..426f446e58 100644--- a/backend/src/lib/errors/index.ts+++ b/backend/src/lib/errors/index.ts@@ -90,10 +90,23 @@ export class BadRequestError extends Error {error: unknown;- constructor({ name, error, message }: { message?: string; name?: string; error?: unknown }) {+ details?: unknown;++ constructor({+ name,+ error,+ message,+ details+ }: {+ message?: string;+ name?: string;+ error?: unknown;+ details?: unknown;+ }) {super(message ?? "The request is invalid");this.name = name || "BadRequest";this.error = error;+ this.details = details;}}diff --git a/backend/src/server/plugins/error-handler.ts b/backend/src/server/plugins/error-handler.tsindex e703df5ef5..d1bae0316a 100644--- a/backend/src/server/plugins/error-handler.ts+++ b/backend/src/server/plugins/error-handler.ts@@ -133,9 +133,13 @@ export const fastifyErrHandler = fastifyPlugin(async (server: FastifyZodProvider}if (error instanceof BadRequestError) {- void res- .status(HttpStatusCodes.BadRequest)- .send({ reqId: req.id, statusCode: HttpStatusCodes.BadRequest, message: error.message, error: error.name });+ void res.status(HttpStatusCodes.BadRequest).send({+ reqId: req.id,+ statusCode: HttpStatusCodes.BadRequest,+ message: error.message,+ error: error.name,+ details: error.details+ });} else if (error instanceof NotFoundError) {void res.status(HttpStatusCodes.NotFound)diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 3a00664532..f822823618 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -258,6 +258,7 @@ import { membershipIdentityDALFactory } from "@app/services/membership-identity/import { membershipIdentityServiceFactory } from "@app/services/membership-identity/membership-identity-service";import { membershipUserDALFactory } from "@app/services/membership-user/membership-user-dal";import { membershipUserServiceFactory } from "@app/services/membership-user/membership-user-service";+import { mfaSessionServiceFactory } from "@app/services/mfa-session/mfa-session-service";import { microsoftTeamsIntegrationDALFactory } from "@app/services/microsoft-teams/microsoft-teams-integration-dal";import { microsoftTeamsServiceFactory } from "@app/services/microsoft-teams/microsoft-teams-service";import { projectMicrosoftTeamsConfigDALFactory } from "@app/services/microsoft-teams/project-microsoft-teams-config-dal";@@ -351,12 +352,12 @@ import { telemetryServiceFactory } from "@app/services/telemetry/telemetry-serviimport { totpConfigDALFactory } from "@app/services/totp/totp-config-dal";import { totpServiceFactory } from "@app/services/totp/totp-service";import { upgradePathServiceFactory } from "@app/services/upgrade-path/upgrade-path-service";-import { webAuthnCredentialDALFactory } from "@app/services/webauthn/webauthn-credential-dal";-import { webAuthnServiceFactory } from "@app/services/webauthn/webauthn-service";import { userDALFactory } from "@app/services/user/user-dal";import { userServiceFactory } from "@app/services/user/user-service";import { userAliasDALFactory } from "@app/services/user-alias/user-alias-dal";import { userEngagementServiceFactory } from "@app/services/user-engagement/user-engagement-service";+import { webAuthnCredentialDALFactory } from "@app/services/webauthn/webauthn-credential-dal";+import { webAuthnServiceFactory } from "@app/services/webauthn/webauthn-service";import { webhookDALFactory } from "@app/services/webhook/webhook-dal";import { webhookServiceFactory } from "@app/services/webhook/webhook-service";import { workflowIntegrationDALFactory } from "@app/services/workflow-integration/workflow-integration-dal";@@ -878,7 +879,8 @@ export const registerRoutes = async (const webAuthnService = webAuthnServiceFactory({webAuthnCredentialDAL,userDAL,- tokenService+ tokenService,+ keyStore});const loginService = authLoginServiceFactory({@@ -2347,6 +2349,13 @@ export const registerRoutes = async (gatewayV2Service});+ const mfaSessionService = mfaSessionServiceFactory({+ keyStore,+ tokenService,+ smtpService,+ totpService+ });+const pamAccountService = pamAccountServiceFactory({pamAccountDAL,gatewayV2Service,@@ -2357,8 +2366,12 @@ export const registerRoutes = async (pamSessionDAL,permissionService,projectDAL,+ orgDAL,userDAL,- auditLogService+ auditLogService,+ keyStore,+ tokenService,+ smtpService});const pamAccountRotation = pamAccountRotationServiceFactory({@@ -2554,6 +2567,7 @@ export const registerRoutes = async (pamResource: pamResourceService,pamAccount: pamAccountService,pamSession: pamSessionService,+ mfaSession: mfaSessionService,upgradePath: upgradePathService,membershipUser: membershipUserService,diff --git a/backend/src/server/routes/sanitizedSchemas.ts b/backend/src/server/routes/sanitizedSchemas.tsindex 17cfcb5ce4..a4dce3ad74 100644--- a/backend/src/server/routes/sanitizedSchemas.ts+++ b/backend/src/server/routes/sanitizedSchemas.ts@@ -37,7 +37,8 @@ export const DefaultResponseErrorsSchema = {reqId: z.string(),statusCode: z.literal(400),message: z.string(),- error: z.string()+ error: z.string(),+ details: z.any().optional()}),404: z.object({reqId: z.string(),diff --git a/backend/src/server/routes/v2/index.ts b/backend/src/server/routes/v2/index.tsindex d3d91a3baa..80c7672393 100644--- a/backend/src/server/routes/v2/index.ts+++ b/backend/src/server/routes/v2/index.ts@@ -6,6 +6,7 @@ import { registerDeprecatedProjectMembershipRouter } from "./deprecated-project-import { registerDeprecatedProjectRouter } from "./deprecated-project-router";import { registerIdentityOrgRouter } from "./identity-org-router";import { registerMfaRouter } from "./mfa-router";+import { registerMfaSessionRouter } from "./mfa-session-router";import { registerOrgRouter } from "./organization-router";import { registerPasswordRouter } from "./password-router";import { registerPkiAlertRouter } from "./pki-alert-router";@@ -17,6 +18,7 @@ import { registerUserRouter } from "./user-router";export const registerV2Routes = async (server: FastifyZodProvider) => {await server.register(registerMfaRouter, { prefix: "/auth" });+ await server.register(registerMfaSessionRouter, { prefix: "/mfa-sessions" });await server.register(registerUserRouter, { prefix: "/users" });await server.register(registerServiceTokenRouter, { prefix: "/service-token" });await server.register(registerPasswordRouter, { prefix: "/password" });diff --git a/backend/src/server/routes/v2/mfa-session-router.ts b/backend/src/server/routes/v2/mfa-session-router.tsnew file mode 100644index 0000000000..bf3fcef964--- /dev/null+++ b/backend/src/server/routes/v2/mfa-session-router.ts@@ -0,0 +1,72 @@+import { z } from "zod";++import { readLimit, writeLimit } from "@app/server/config/rateLimiter";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";+import { AuthMode, MfaMethod } from "@app/services/auth/auth-type";+import { MfaSessionStatus } from "@app/services/mfa-session/mfa-session-types";++export const registerMfaSessionRouter = async (server: FastifyZodProvider) => {+ server.route({+ method: "POST",+ url: "/:mfaSessionId/verify",+ config: {+ rateLimit: writeLimit+ },+ schema: {+ description: "Verify MFA session",+ params: z.object({+ mfaSessionId: z.string().trim()+ }),+ body: z.object({+ mfaToken: z.string().trim(),+ mfaMethod: z.nativeEnum(MfaMethod)+ }),+ response: {+ 200: z.object({+ success: z.boolean(),+ message: z.string()+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const result = await server.services.mfaSession.verifyMfaSession({+ mfaSessionId: req.params.mfaSessionId,+ userId: req.permission.id,+ mfaToken: req.body.mfaToken,+ mfaMethod: req.body.mfaMethod+ });++ return result;+ }+ });++ server.route({+ method: "GET",+ url: "/:mfaSessionId/status",+ config: {+ rateLimit: readLimit+ },+ schema: {+ description: "Get MFA session status",+ params: z.object({+ mfaSessionId: z.string().trim()+ }),+ response: {+ 200: z.object({+ status: z.nativeEnum(MfaSessionStatus),+ mfaMethod: z.nativeEnum(MfaMethod)+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const result = await server.services.mfaSession.getMfaSessionStatus({+ mfaSessionId: req.params.mfaSessionId,+ userId: req.permission.id+ });++ return result;+ }+ });+};diff --git a/backend/src/services/mfa-session/mfa-session-service.ts b/backend/src/services/mfa-session/mfa-session-service.tsnew file mode 100644index 0000000000..c255b88a84--- /dev/null+++ b/backend/src/services/mfa-session/mfa-session-service.ts@@ -0,0 +1,142 @@+import { KeyStorePrefixes, KeyStoreTtls, TKeyStoreFactory } from "@app/keystore/keystore";+import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";+import { MfaMethod } from "@app/services/auth/auth-type";+import { TAuthTokenServiceFactory } from "@app/services/auth-token/auth-token-service";+import { TokenType } from "@app/services/auth-token/auth-token-types";+import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";+import { TTotpServiceFactory } from "@app/services/totp/totp-service";++import { MfaSessionStatus, TGetMfaSessionStatusDTO, TMfaSession, TVerifyMfaSessionDTO } from "./mfa-session-types";++type TMfaSessionServiceFactoryDep = {+ keyStore: Pick<TKeyStoreFactory, "getItem" | "setItemWithExpiry" | "deleteItem">;+ tokenService: Pick<TAuthTokenServiceFactory, "createTokenForUser" | "validateTokenForUser">;+ smtpService: Pick<TSmtpService, "sendMail">;+ totpService: Pick<TTotpServiceFactory, "verifyUserTotp" | "verifyWithUserRecoveryCode">;+};++export type TMfaSessionServiceFactory = ReturnType<typeof mfaSessionServiceFactory>;++export const mfaSessionServiceFactory = ({+ keyStore,+ tokenService,+ smtpService,+ totpService+}: TMfaSessionServiceFactoryDep) => {+ // Helper function to get MFA session from Redis+ const getMfaSession = async (mfaSessionId: string): Promise<TMfaSession | null> => {+ const mfaSessionKey = KeyStorePrefixes.MfaSession(mfaSessionId);+ const mfaSessionData = await keyStore.getItem(mfaSessionKey);++ if (!mfaSessionData) {+ return null;+ }++ return JSON.parse(mfaSessionData) as TMfaSession;+ };++ // Helper function to update MFA session in Redis+ const updateMfaSession = async (mfaSession: TMfaSession, ttlSeconds: number): Promise<void> => {+ const mfaSessionKey = KeyStorePrefixes.MfaSession(mfaSession.sessionId);+ await keyStore.setItemWithExpiry(mfaSessionKey, ttlSeconds, JSON.stringify(mfaSession));+ };++ // Helper function to send MFA code via email+ const sendMfaCode = async (userId: string, email: string) => {+ const code = await tokenService.createTokenForUser({+ type: TokenType.TOKEN_EMAIL_MFA,+ userId+ });++ await smtpService.sendMail({+ template: SmtpTemplates.EmailMfa,+ subjectLine: "Infisical MFA code",+ recipients: [email],+ substitutions: {+ code+ }+ });+ };++ const verifyMfaSession = async ({ mfaSessionId, userId, mfaToken, mfaMethod }: TVerifyMfaSessionDTO) => {+ const mfaSession = await getMfaSession(mfaSessionId);++ if (!mfaSession) {+ throw new BadRequestError({+ message: "MFA session not found or expired"+ });+ }++ // Verify the session belongs to the current user+ if (mfaSession.userId !== userId) {+ throw new ForbiddenRequestError({+ message: "MFA session does not belong to current user"+ });+ }++ try {+ if (mfaMethod === MfaMethod.EMAIL) {+ await tokenService.validateTokenForUser({+ type: TokenType.TOKEN_EMAIL_MFA,+ userId,+ code: mfaToken+ });+ } else if (mfaMethod === MfaMethod.TOTP) {+ if (mfaToken.length !== 6) {+ throw new BadRequestError({+ message: "Please use a valid TOTP code."+ });+ }+ await totpService.verifyUserTotp({+ userId,+ totp: mfaToken+ });+ } else if (mfaMethod === MfaMethod.WEBAUTHN) {+ await tokenService.validateTokenForUser({+ type: TokenType.TOKEN_WEBAUTHN_SESSION,+ userId,+ code: mfaToken+ });+ }+ } catch (error) {+ throw new BadRequestError({+ message: "Invalid MFA code"+ });+ }++ mfaSession.status = MfaSessionStatus.ACTIVE;+ await updateMfaSession(mfaSession, KeyStoreTtls.MfaSessionInSeconds);++ return {+ success: true,+ message: "MFA verification successful"+ };+ };++ const getMfaSessionStatus = async ({ mfaSessionId, userId }: TGetMfaSessionStatusDTO) => {+ const mfaSession = await getMfaSession(mfaSessionId);++ if (!mfaSession) {+ throw new NotFoundError({+ message: "MFA session not found or expired"+ });+ }++ if (mfaSession.userId !== userId) {+ throw new ForbiddenRequestError({+ message: "MFA session does not belong to current user"+ });+ }++ return {+ status: mfaSession.status,+ mfaMethod: mfaSession.mfaMethod+ };+ };++ return {+ verifyMfaSession,+ getMfaSessionStatus,+ sendMfaCode+ };+};diff --git a/backend/src/services/mfa-session/mfa-session-types.ts b/backend/src/services/mfa-session/mfa-session-types.tsnew file mode 100644index 0000000000..6dcb45ee90--- /dev/null+++ b/backend/src/services/mfa-session/mfa-session-types.ts@@ -0,0 +1,32 @@+import { MfaMethod } from "@app/services/auth/auth-type";++export enum MfaSessionStatus {+ PENDING = "PENDING",+ ACTIVE = "ACTIVE"+}++export type TMfaSession = {+ sessionId: string;+ userId: string;+ resourceId: string; // Generic - can be accountId, documentId, etc.+ status: MfaSessionStatus;+ mfaMethod: MfaMethod;+};++export type TCreateMfaSessionDTO = {+ userId: string;+ resourceId: string;+ mfaMethod: MfaMethod;+};++export type TVerifyMfaSessionDTO = {+ mfaSessionId: string;+ userId: string;+ mfaToken: string;+ mfaMethod: MfaMethod;+};++export type TGetMfaSessionStatusDTO = {+ mfaSessionId: string;+ userId: string;+};diff --git a/backend/src/services/webauthn/webauthn-service.ts b/backend/src/services/webauthn/webauthn-service.tsindex 5966572416..6b204149bf 100644--- a/backend/src/services/webauthn/webauthn-service.ts+++ b/backend/src/services/webauthn/webauthn-service.ts@@ -8,6 +8,7 @@ import {verifyRegistrationResponse} from "@simplewebauthn/server";+import { KeyStorePrefixes, KeyStoreTtls, TKeyStoreFactory } from "@app/keystore/keystore";import { getConfig } from "@app/lib/config/env";import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";@@ -30,48 +31,32 @@ type TWebAuthnServiceFactoryDep = {userDAL: TUserDALFactory;webAuthnCredentialDAL: TWebAuthnCredentialDALFactory;tokenService: TAuthTokenServiceFactory;+ keyStore: TKeyStoreFactory;};export type TWebAuthnServiceFactory = ReturnType<typeof webAuthnServiceFactory>;-// In-memory challenge storage (for development)-// TODO: In production, use Redis or database with TTL-const challengeStore = new Map<string, { challenge: string; timestamp: number }>();-const CHALLENGE_TTL = 5 * 60 * 1000; // 5 minutes--const storeChallenge = (userId: string, challenge: string) => {- challengeStore.set(userId, { challenge, timestamp: Date.now() });-- // Cleanup expired challenges- for (const [key, value] of challengeStore.entries()) {- if (Date.now() - value.timestamp > CHALLENGE_TTL) {- challengeStore.delete(key);- }- }-};--const getChallenge = (userId: string): string | null => {- const stored = challengeStore.get(userId);- if (!stored) return null;-- // Check if expired- if (Date.now() - stored.timestamp > CHALLENGE_TTL) {- challengeStore.delete(userId);- return null;- }-- return stored.challenge;-};--const clearChallenge = (userId: string) => {- challengeStore.delete(userId);-};-export const webAuthnServiceFactory = ({userDAL,webAuthnCredentialDAL,- tokenService+ tokenService,+ keyStore}: TWebAuthnServiceFactoryDep) => {+ const storeChallenge = async (userId: string, challenge: string) => {+ const challengeKey = KeyStorePrefixes.WebAuthnChallenge(userId);+ await keyStore.setItemWithExpiry(challengeKey, KeyStoreTtls.WebAuthnChallengeInSeconds, challenge);+ };++ const getChallenge = async (userId: string): Promise<string | null> => {+ const challengeKey = KeyStorePrefixes.WebAuthnChallenge(userId);+ return keyStore.getItem(challengeKey);+ };++ const clearChallenge = async (userId: string) => {+ const challengeKey = KeyStorePrefixes.WebAuthnChallenge(userId);+ await keyStore.deleteItem(challengeKey);+ };+const appCfg = getConfig();// Relying Party (RP) information - extracted from SITE_URL@@ -114,7 +99,7 @@ export const webAuthnServiceFactory = ({});// Store challenge for verification- storeChallenge(userId, options.challenge);+ await storeChallenge(userId, options.challenge);return options;};@@ -137,7 +122,7 @@ export const webAuthnServiceFactory = ({}// Retrieve the stored challenge- const expectedChallenge = getChallenge(userId);+ const expectedChallenge = await getChallenge(userId);if (!expectedChallenge) {throw new BadRequestError({message: "Challenge not found or expired. Please try registering again."@@ -154,14 +139,14 @@ export const webAuthnServiceFactory = ({requireUserVerification: true});} catch (error: unknown) {- clearChallenge(userId);+ await clearChallenge(userId);throw new BadRequestError({message: `Registration verification failed: ${error instanceof Error ? error.message : "Unknown error"}`});}if (!verification.verified || !verification.registrationInfo) {- clearChallenge(userId);+ await clearChallenge(userId);throw new BadRequestError({message: "Registration verification failed"});@@ -176,7 +161,7 @@ export const webAuthnServiceFactory = ({});if (existingCredential) {- clearChallenge(userId);+ await clearChallenge(userId);throw new BadRequestError({message: "This credential has already been registered"});@@ -193,7 +178,7 @@ export const webAuthnServiceFactory = ({});// Clear the challenge- clearChallenge(userId);+ await clearChallenge(userId);return {credentialId: credential.credentialId,@@ -224,7 +209,7 @@ export const webAuthnServiceFactory = ({});// Store challenge for verification- storeChallenge(userId, options.challenge);+ await storeChallenge(userId, options.challenge);return options;};@@ -262,7 +247,7 @@ export const webAuthnServiceFactory = ({}// Retrieve the stored challenge- const expectedChallenge = getChallenge(userId);+ const expectedChallenge = await getChallenge(userId);if (!expectedChallenge) {throw new BadRequestError({message: "Challenge not found or expired. Please try authenticating again."@@ -284,14 +269,14 @@ export const webAuthnServiceFactory = ({requireUserVerification: true});} catch (error: unknown) {- clearChallenge(userId);+ await clearChallenge(userId);throw new BadRequestError({message: `Authentication verification failed: ${error instanceof Error ? error.message : "Unknown error"}`});}if (!verification.verified) {- clearChallenge(userId);+ await clearChallenge(userId);throw new BadRequestError({message: "Authentication verification failed"});@@ -304,7 +289,7 @@ export const webAuthnServiceFactory = ({});// Clear the challenge- clearChallenge(userId);+ await clearChallenge(userId);// Generate one-time WebAuthn session token with 60-second expirationconst sessionToken = await tokenService.createTokenForUser({diff --git a/frontend/src/helpers/mfaSession.ts b/frontend/src/helpers/mfaSession.tsnew file mode 100644index 0000000000..d9864b4046--- /dev/null+++ b/frontend/src/helpers/mfaSession.ts@@ -0,0 +1,16 @@+import { MfaMethod } from "@app/hooks/api/auth/types";++export type TMfaSessionError = {+ name: "SESSION_MFA_REQUIRED";+ message: string;+ error: {+ mfaSessionId: string;+ mfaMethod: MfaMethod;+ };+};++export const isMfaSessionError = (+ error: any+): error is { response: { data: TMfaSessionError } } => {+ return error?.response?.data?.name === "SESSION_MFA_REQUIRED";+};diff --git a/frontend/src/hooks/api/index.tsx b/frontend/src/hooks/api/index.tsxindex 0216ae0300..6c4a0ca27b 100644--- a/frontend/src/hooks/api/index.tsx+++ b/frontend/src/hooks/api/index.tsx@@ -22,6 +22,7 @@ export * from "./integrationAuth";export * from "./integrations";export * from "./kms";export * from "./ldapConfig";+export * from "./mfaSession";export * from "./oidcConfig";export * from "./orgAdmin";export * from "./organization";diff --git a/frontend/src/hooks/api/mfaSession/index.tsx b/frontend/src/hooks/api/mfaSession/index.tsxnew file mode 100644index 0000000000..4980a7e5af--- /dev/null+++ b/frontend/src/hooks/api/mfaSession/index.tsx@@ -0,0 +1 @@+export { MfaSessionStatus, useMfaSessionStatus, useVerifyMfaSession } from "./queries";diff --git a/frontend/src/hooks/api/mfaSession/queries.tsx b/frontend/src/hooks/api/mfaSession/queries.tsxnew file mode 100644index 0000000000..b074b545b8--- /dev/null+++ b/frontend/src/hooks/api/mfaSession/queries.tsx@@ -0,0 +1,61 @@+import { useMutation, useQuery } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { MfaMethod } from "../auth/types";++export enum MfaSessionStatus {+ PENDING = "PENDING",+ ACTIVE = "ACTIVE"+}++export type TMfaSessionStatusResponse = {+ status: MfaSessionStatus;+ mfaMethod: MfaMethod;+};++export type TVerifyMfaSessionRequest = {+ mfaSessionId: string;+ mfaToken: string;+ mfaMethod: MfaMethod;+};++export type TVerifyMfaSessionResponse = {+ success: boolean;+ message: string;+};++export const useMfaSessionStatus = (mfaSessionId: string, enabled = true) => {+ return useQuery({+ queryKey: ["mfa-session-status", mfaSessionId],+ queryFn: async () => {+ const { data } = await apiRequest.get<TMfaSessionStatusResponse>(+ `/api/v2/mfa-sessions/${mfaSessionId}/status`+ );+ return data;+ },+ enabled,+ refetchInterval: (query) => {+ // Poll every 2 seconds if status is still PENDING+ if (query.state.data?.status === MfaSessionStatus.PENDING) {+ return 2000;+ }+ return false;+ }+ });+};++export const useVerifyMfaSession = () => {+ return useMutation({+ mutationFn: async ({ mfaSessionId, mfaToken, mfaMethod }: TVerifyMfaSessionRequest) => {+ const { data } = await apiRequest.post<TVerifyMfaSessionResponse>(+ `/api/v2/mfa-sessions/${mfaSessionId}/verify`,+ {+ mfaToken,+ mfaMethod+ }+ );+ return data;+ }+ });+};diff --git a/frontend/src/pages/MfaSessionPage/MfaSessionPage.tsx b/frontend/src/pages/MfaSessionPage/MfaSessionPage.tsxnew file mode 100644index 0000000000..ab5f73af33--- /dev/null+++ b/frontend/src/pages/MfaSessionPage/MfaSessionPage.tsx@@ -0,0 +1,311 @@+import { useEffect, useState } from "react";+import ReactCodeInput from "react-code-input";+import { startAuthentication } from "@simplewebauthn/browser";+import { useParams } from "@tanstack/react-router";++import Error from "@app/components/basic/Error";+import { createNotification } from "@app/components/notifications";+import { Button } from "@app/components/v2";+import { MfaMethod } from "@app/hooks/api/auth/types";+import {+ MfaSessionStatus,+ useMfaSessionStatus,+ useVerifyMfaSession+} from "@app/hooks/api/mfaSession";+import { useGenerateAuthenticationOptions, useVerifyAuthentication } from "@app/hooks/api/webauthn";++const codeInputProps = {+ inputStyle: {+ fontFamily: "monospace",+ margin: "4px",+ MozAppearance: "textfield",+ width: "55px",+ borderRadius: "5px",+ fontSize: "24px",+ height: "55px",+ paddingLeft: "7",+ backgroundColor: "#0d1117",+ color: "white",+ border: "1px solid #2d2f33",+ textAlign: "center",+ outlineColor: "#8ca542",+ borderColor: "#2d2f33"+ }+} as const;++const codeInputPropsPhone = {+ inputStyle: {+ fontFamily: "monospace",+ margin: "4px",+ MozAppearance: "textfield",+ width: "40px",+ borderRadius: "5px",+ fontSize: "24px",+ height: "40px",+ paddingLeft: "7",+ backgroundColor: "#0d1117",+ color: "white",+ border: "1px solid #2d2f33",+ textAlign: "center",+ outlineColor: "#8ca542",+ borderColor: "#2d2f33"+ }+} as const;++export const MfaSessionPage = () => {+ const { mfaSessionId } = useParams({ strict: false }) as { mfaSessionId: string };++ const [mfaCode, setMfaCode] = useState("");+ const [isLoading, setIsLoading] = useState(false);+ const [error, setError] = useState<string | null>(null);++ const { data: sessionStatus, isError: isStatusError } = useMfaSessionStatus(mfaSessionId);+ const verifyMfaSession = useVerifyMfaSession();+ const { mutateAsync: generateWebAuthnAuthenticationOptions } = useGenerateAuthenticationOptions();+ const { mutateAsync: verifyWebAuthnAuthentication } = useVerifyAuthentication();++ // Show notification and auto-close when MFA is completed+ useEffect(() => {+ if (sessionStatus?.status === MfaSessionStatus.ACTIVE) {+ createNotification({+ text: "MFA verification successful! Closing window...",+ type: "success"+ });++ // Auto-close window after showing success message+ setTimeout(() => {+ window.close();+ }, 1000);+ }+ }, [sessionStatus?.status]);++ // Handle status error (session not found or expired)+ useEffect(() => {+ if (isStatusError) {+ setError("MFA session not found or expired. Please try again.");+ }+ }, [isStatusError]);++ const getExpectedCodeLength = () => {+ if (sessionStatus?.mfaMethod === MfaMethod.EMAIL) return 6;+ if (sessionStatus?.mfaMethod === MfaMethod.TOTP) return 6;+ return 6;+ };++ const isCodeComplete = mfaCode.length === getExpectedCodeLength();++ const handleVerifyMfa = async (event: React.FormEvent<HTMLFormElement>) => {+ event.preventDefault();++ if (!mfaCode.trim() || !isCodeComplete || !sessionStatus?.mfaMethod) return;++ setIsLoading(true);+ setError(null);++ try {+ await verifyMfaSession.mutateAsync({+ mfaSessionId,+ mfaToken: mfaCode.trim(),+ mfaMethod: sessionStatus.mfaMethod+ });++ createNotification({+ text: "MFA verification successful! Closing window...",+ type: "success"+ });++ // Auto-close window after showing success message+ setTimeout(() => {+ window.close();+ }, 1000);+ } catch (err: any) {+ setError(err?.response?.data?.message || "Invalid MFA code. Please try again.");+ setMfaCode("");+ } finally {+ setIsLoading(false);+ }+ };++ const handleWebAuthnVerification = async () => {+ if (!sessionStatus?.mfaMethod) return;++ setIsLoading(true);+ setError(null);++ try {+ // Get authentication options from server+ const options = await generateWebAuthnAuthenticationOptions();++ // Prompt user to authenticate with their passkey+ const authenticationResponse = await startAuthentication({ optionsJSON: options });++ // Verify with server to get session token+ const result = await verifyWebAuthnAuthentication({ authenticationResponse });++ // Use the sessionToken to verify MFA session+ if (result.sessionToken) {+ await verifyMfaSession.mutateAsync({+ mfaSessionId,+ mfaToken: result.sessionToken,+ mfaMethod: MfaMethod.WEBAUTHN+ });++ createNotification({+ text: "MFA verification successful! Closing window...",+ type: "success"+ });++ // Auto-close window after showing success message+ setTimeout(() => {+ window.close();+ }, 1000);+ }+ } catch (err: any) {+ console.error("WebAuthn verification failed:", err);++ let errorMessage = "Failed to verify passkey";+ if (err.name === "NotAllowedError") {+ errorMessage = "Passkey verification was cancelled or timed out";+ } else if (err?.response?.data?.message) {+ errorMessage = err.response.data.message;+ } else if (err.message) {+ errorMessage = err.message;+ }++ setError(errorMessage);+ } finally {+ setIsLoading(false);+ }+ };++ if (isStatusError) {+ return (+ <div className="flex min-h-screen flex-col items-center justify-center bg-bunker-800 bg-linear-to-tr from-mineshaft-600 via-mineshaft-800 to-bunker-700">+ <div className="mx-auto w-max pt-6 pb-6 md:mb-16 md:px-8">+ <div className="mb-4 flex justify-center">+ <img src="/images/gradientLogo.svg" height={90} width={120} alt="Infisical logo" />+ </div>+ <div className="mb-6 text-center">+ <h2 className="mb-3 text-xl font-medium text-red-400">Session Expired</h2>+ <p className="text-bunker-300">+ This MFA session has expired or is invalid. Please try your action again.+ </p>+ </div>+ </div>+ </div>+ );+ }++ if (!sessionStatus) {+ return (+ <div className="flex min-h-screen flex-col items-center justify-center bg-bunker-800 bg-linear-to-tr from-mineshaft-600 via-mineshaft-800 to-bunker-700">+ <div className="text-center">+ <div className="mb-4 text-bunker-300">Loading...</div>+ </div>+ </div>+ );+ }++ if (sessionStatus.status === MfaSessionStatus.ACTIVE) {+ return (+ <div className="flex min-h-screen flex-col items-center justify-center bg-bunker-800 bg-linear-to-tr from-mineshaft-600 via-mineshaft-800 to-bunker-700">+ <div className="mx-auto w-max pt-6 pb-6 md:mb-16 md:px-8">+ <div className="mb-4 flex justify-center">+ <img src="/images/gradientLogo.svg" height={90} width={120} alt="Infisical logo" />+ </div>+ <div className="mb-6 text-center">+ <h2 className="mb-3 text-xl font-medium text-bunker-50">Verification Complete</h2>+ <p className="text-bunker-300">This window will close automatically...</p>+ </div>+ </div>+ </div>+ );+ }++ return (+ <div className="flex min-h-screen flex-col items-center justify-center bg-bunker-800 bg-linear-to-tr from-mineshaft-600 via-mineshaft-800 to-bunker-700">+ <div className="mx-auto w-max pt-6 pb-6 md:mb-16 md:px-8">+ <div className="mb-4 flex justify-center">+ <img src="/images/gradientLogo.svg" height={90} width={120} alt="Infisical logo" />+ </div>++ <div className="mb-8 text-center">+ <h2 className="mb-3 text-xl font-medium text-bunker-100">Two-Factor Authentication</h2>+ <p className="mx-auto max-w-md text-sm leading-relaxed text-bunker-300">+ {sessionStatus.mfaMethod === MfaMethod.EMAIL &&+ "Enter the verification code sent to your email"}+ {sessionStatus.mfaMethod === MfaMethod.TOTP &&+ "Enter the verification code from your authenticator app"}+ {sessionStatus.mfaMethod === MfaMethod.WEBAUTHN &&+ "Use your registered passkey to complete two-factor authentication"}+ </p>+ </div>++ {sessionStatus.mfaMethod === MfaMethod.WEBAUTHN ? (+ <>+ {error && <Error text={error} />}+ <div className="mx-auto mt-6 flex w-full max-w-sm flex-col items-center justify-center text-center">+ <Button+ size="md"+ onClick={handleWebAuthnVerification}+ isFullWidth+ className="h-11 rounded-lg font-medium shadow-xs transition-all duration-200 hover:shadow-md"+ colorSchema="primary"+ variant="outline_bg"+ isLoading={isLoading}+ >+ Authenticate with Passkey+ </Button>+ </div>+ </>+ ) : (+ <form onSubmit={handleVerifyMfa}>+ <div className="mx-auto hidden md:block" style={{ minWidth: "600px" }}>+ <div className="mt-8 mb-6 flex justify-center">+ <ReactCodeInput+ name=""+ inputMode="tel"+ type="text"+ fields={getExpectedCodeLength()}+ onChange={setMfaCode}+ value={mfaCode}+ className="mb-2"+ {...codeInputProps}+ />+ </div>+ </div>+ <div className="mx-auto mt-4 block md:hidden" style={{ minWidth: "400px" }}>+ <div className="mt-4 mb-6 flex justify-center">+ <ReactCodeInput+ name=""+ inputMode="tel"+ type="text"+ fields={getExpectedCodeLength()}+ onChange={setMfaCode}+ value={mfaCode}+ className="mb-2"+ {...codeInputPropsPhone}+ />+ </div>+ </div>+ {error && <Error text={error} />}+ <div className="mx-auto mt-6 flex w-full max-w-sm flex-col items-center justify-center text-center">+ <Button+ size="md"+ type="submit"+ isFullWidth+ className="h-11 rounded-lg font-medium shadow-xs transition-all duration-200 hover:shadow-md"+ colorSchema="primary"+ variant="outline_bg"+ isLoading={isLoading}+ isDisabled={!isCodeComplete}+ >+ Verify+ </Button>+ </div>+ </form>+ )}+ </div>+ </div>+ );+};diff --git a/frontend/src/pages/MfaSessionPage/index.tsx b/frontend/src/pages/MfaSessionPage/index.tsxnew file mode 100644index 0000000000..3b769085ad--- /dev/null+++ b/frontend/src/pages/MfaSessionPage/index.tsx@@ -0,0 +1 @@+export { MfaSessionPage } from "./MfaSessionPage";diff --git a/frontend/src/pages/MfaSessionPage/route.tsx b/frontend/src/pages/MfaSessionPage/route.tsxnew file mode 100644index 0000000000..a66b02443e--- /dev/null+++ b/frontend/src/pages/MfaSessionPage/route.tsx@@ -0,0 +1,7 @@+import { createFileRoute } from "@tanstack/react-router";++import { MfaSessionPage } from "./MfaSessionPage";++export const Route = createFileRoute("/_authenticate/mfa-session/$mfaSessionId")({+ component: MfaSessionPage+});diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.tsindex 4c6558db97..7a93187b43 100644--- a/frontend/src/routeTree.gen.ts+++ b/frontend/src/routeTree.gen.ts@@ -37,6 +37,7 @@ import { Route as authLoginLdapPageRouteImport } from './pages/auth/LoginLdapPagimport { Route as authAdminLoginPageRouteImport } from './pages/auth/AdminLoginPage/route'import { Route as adminSignUpPageRouteImport } from './pages/admin/SignUpPage/route'import { Route as organizationNoOrgPageRouteImport } from './pages/organization/NoOrgPage/route'+import { Route as MfaSessionPageRouteImport } from './pages/MfaSessionPage/route'import { Route as authSignUpPageRouteImport } from './pages/auth/SignUpPage/route'import { Route as authLoginPageRouteImport } from './pages/auth/LoginPage/route'import { Route as adminLayoutImport } from './pages/admin/layout'@@ -513,6 +514,12 @@ const organizationNoOrgPageRouteRoute = organizationNoOrgPageRouteImport.update(} as any,)+const MfaSessionPageRouteRoute = MfaSessionPageRouteImport.update({+ id: '/mfa-session/$mfaSessionId',+ path: '/mfa-session/$mfaSessionId',+ getParentRoute: () => middlewaresAuthenticateRoute,+} as any)+const authSignUpPageRouteRoute = authSignUpPageRouteImport.update({id: '/',path: '/',@@ -2302,6 +2309,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof authSignUpPageRouteImportparentRoute: typeof RestrictLoginSignupSignupImport}+ '/_authenticate/mfa-session/$mfaSessionId': {+ id: '/_authenticate/mfa-session/$mfaSessionId'+ path: '/mfa-session/$mfaSessionId'+ fullPath: '/mfa-session/$mfaSessionId'+ preLoaderRoute: typeof MfaSessionPageRouteImport+ parentRoute: typeof middlewaresAuthenticateImport+ }'/_authenticate/organization/none': {id: '/_authenticate/organization/none'path: '/organization/none'@@ -4880,6 +4894,7 @@ interface middlewaresAuthenticateRouteChildren {authPasswordSetupPageRouteRoute: typeof authPasswordSetupPageRouteRoutemiddlewaresInjectOrgDetailsRoute: typeof middlewaresInjectOrgDetailsRouteWithChildrenAuthenticatePersonalSettingsRoute: typeof AuthenticatePersonalSettingsRouteWithChildren+ MfaSessionPageRouteRoute: typeof MfaSessionPageRouteRouteorganizationNoOrgPageRouteRoute: typeof organizationNoOrgPageRouteRoute}@@ -4890,6 +4905,7 @@ const middlewaresAuthenticateRouteChildren: middlewaresAuthenticateRouteChildrenmiddlewaresInjectOrgDetailsRouteWithChildren,AuthenticatePersonalSettingsRoute:AuthenticatePersonalSettingsRouteWithChildren,+ MfaSessionPageRouteRoute: MfaSessionPageRouteRoute,organizationNoOrgPageRouteRoute: organizationNoOrgPageRouteRoute,}@@ -4985,6 +5001,7 @@ export interface FileRoutesByFullPath {'/signup': typeof RestrictLoginSignupSignupRouteWithChildren'/login/': typeof authLoginPageRouteRoute'/signup/': typeof authSignUpPageRouteRoute+ '/mfa-session/$mfaSessionId': typeof MfaSessionPageRouteRoute'/organization/none': typeof organizationNoOrgPageRouteRoute'/admin/signup': typeof adminSignUpPageRouteRoute'/login/admin': typeof authAdminLoginPageRouteRoute@@ -5222,6 +5239,7 @@ export interface FileRoutesByTo {'/personal-settings': typeof userPersonalSettingsPageRouteRoute'/login': typeof authLoginPageRouteRoute'/signup': typeof authSignUpPageRouteRoute+ '/mfa-session/$mfaSessionId': typeof MfaSessionPageRouteRoute'/organization/none': typeof organizationNoOrgPageRouteRoute'/admin/signup': typeof adminSignUpPageRouteRoute'/login/admin': typeof authAdminLoginPageRouteRoute@@ -5451,6 +5469,7 @@ export interface FileRoutesById {'/_restrict-login-signup/signup': typeof RestrictLoginSignupSignupRouteWithChildren'/_restrict-login-signup/login/': typeof authLoginPageRouteRoute'/_restrict-login-signup/signup/': typeof authSignUpPageRouteRoute+ '/_authenticate/mfa-session/$mfaSessionId': typeof MfaSessionPageRouteRoute'/_authenticate/organization/none': typeof organizationNoOrgPageRouteRoute'/_restrict-login-signup/admin/signup': typeof adminSignUpPageRouteRoute'/_restrict-login-signup/login/admin': typeof authAdminLoginPageRouteRoute@@ -5701,6 +5720,7 @@ export interface FileRouteTypes {| '/signup'| '/login/'| '/signup/'+ | '/mfa-session/$mfaSessionId'| '/organization/none'| '/admin/signup'| '/login/admin'@@ -5937,6 +5957,7 @@ export interface FileRouteTypes {| '/personal-settings'| '/login'| '/signup'+ | '/mfa-session/$mfaSessionId'| '/organization/none'| '/admin/signup'| '/login/admin'@@ -6164,6 +6185,7 @@ export interface FileRouteTypes {| '/_restrict-login-signup/signup'| '/_restrict-login-signup/login/'| '/_restrict-login-signup/signup/'+ | '/_authenticate/mfa-session/$mfaSessionId'| '/_authenticate/organization/none'| '/_restrict-login-signup/admin/signup'| '/_restrict-login-signup/login/admin'@@ -6459,6 +6481,7 @@ export const routeTree = rootRoute"/_authenticate/password-setup","/_authenticate/_inject-org-details","/_authenticate/personal-settings",+ "/_authenticate/mfa-session/$mfaSessionId","/_authenticate/organization/none"]},@@ -6543,6 +6566,10 @@ export const routeTree = rootRoute"filePath": "auth/SignUpPage/route.tsx","parent": "/_restrict-login-signup/signup"},+ "/_authenticate/mfa-session/$mfaSessionId": {+ "filePath": "MfaSessionPage/route.tsx",+ "parent": "/_authenticate"+ },"/_authenticate/organization/none": {"filePath": "organization/NoOrgPage/route.tsx","parent": "/_authenticate"diff --git a/frontend/src/routes.ts b/frontend/src/routes.tsindex cc37f30318..7403b3bb37 100644--- a/frontend/src/routes.ts+++ b/frontend/src/routes.ts@@ -422,6 +422,7 @@ export const routes = rootRoute("root.tsx", []),middleware("authenticate.tsx", [route("/password-setup", "auth/PasswordSetupPage/route.tsx"),+ route("/mfa-session/$mfaSessionId", "MfaSessionPage/route.tsx"),route("/personal-settings", [layout("user/layout.tsx", [index("user/PersonalSettingsPage/route.tsx")])]),