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
remove signup friction
Thiago Araujo da Silvaef18a6b4ff51
diff --git a/backend/AGENTS.md b/backend/AGENTS.mdindex c1b439ef66..2a803c58d6 100644--- a/backend/AGENTS.md+++ b/backend/AGENTS.md@@ -307,8 +307,9 @@ two factors (possession-only classes such as `Smartcard` and `SoftwarePKI` are nattribute named by `saml_configs.mfaSignalAttribute` contains `mfa`. Both names default to `amr`, and theper-config allowlists extend the built-in values rather than replace them. The verdict travels on the org-lesssession token as `idpMfaOrgId`, the root org whose SSO config produced it (absent when the IdP did not signal-MFA), and `selectOrganization` (`auth-login-service.ts`) applies it through `isIdpMfaTrusted` (`auth-fns.ts`),-the only reader of the setting. Rules that must hold:+MFA). A first login that still has to verify its mailbox carries it on the signup token instead, and+`completeAccount` copies it onto the session it mints. `selectOrganization` (`auth-login-service.ts`) applies it+through `isIdpMfaTrusted` (`auth-fns.ts`), the only reader of the setting. Rules that must hold:- Enforcement is decided once per selection against the root org (`actorRootOrgId`), so moving between a rootorg and its sub-orgs never re-prompts.diff --git a/backend/e2e-test/routes/v3/auth-signup-sso.spec.ts b/backend/e2e-test/routes/v3/auth-signup-sso.spec.tsindex 884979e868..a7cccfca5a 100644--- a/backend/e2e-test/routes/v3/auth-signup-sso.spec.ts+++ b/backend/e2e-test/routes/v3/auth-signup-sso.spec.ts@@ -132,6 +132,42 @@ describe("Auth SSO Signup V3", () => {expect(user?.isEmailVerified).toBe(true);});+ test("A trusted IdP MFA proof survives email verification onto the first session", async () => {+ const email = `sso-mfa-${crypto.randomUUID()}@${TEST_DOMAIN}`;++ const result = await getServices().saml.samlLogin({+ externalId: `sso-mfa-${crypto.randomUUID()}`,+ email,+ firstName: "SSO",+ lastName: "Mfa",+ authProvider: "okta-saml",+ orgId: TEST_ORG_ID,+ ip: "127.0.0.1",+ userAgent: "test-agent",+ idpMfa: { verified: true, evidence: ["amr=mfa"], received: ["amr=pwd", "amr=mfa"] }+ });++ expect(result.result).toBe(ProviderAuthResult.SIGNUP_REQUIRED);+ createdUserIds.push(result.userId);+ expect((decode(result.signupToken) as Record<string, unknown>).idpMfaOrgId).toBe(TEST_ORG_ID);++ const verificationEmail = smtp()+ .getEmails()+ .find((e) => e.recipients?.includes(email));+ const code = (verificationEmail?.substitutions as Record<string, string>)?.code;+ expect(code).toBeDefined();++ const res = await testServer.inject({+ method: "POST",+ url: "/api/v3/signup/complete-account",+ headers: { authorization: `Bearer ${result.signupToken}` },+ body: { type: "alias", code }+ });++ expect(res.statusCode).toBe(200);+ expect((decode(res.json().token) as Record<string, unknown>).idpMfaOrgId).toBe(TEST_ORG_ID);+ });+test("Complete SSO account with wrong code fails", async () => {const email = `sso-wrongcode-${crypto.randomUUID()}@${TEST_DOMAIN}`;diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.tsindex b384f9f248..a95cb832b1 100644--- a/backend/src/services/auth/auth-login-service.ts+++ b/backend/src/services/auth/auth-login-service.ts@@ -336,6 +336,10 @@ export const authLoginServiceFactory = ({}: TProcessProviderCallbackDTO): Promise<TProviderAuthCallback> => {const appCfg = getConfig();+ const idpMfaOrgId = idpMfa?.verified ? organizationId : undefined;++ // A first login that still has to verify its mailbox finishes in completeAccount, which mints the session+ // from this token, so the proof rides along or that one login would be prompted despite the trust.if (!user.isAccepted || !isEmailVerified) {const signupToken = crypto.jwt().sign({@@ -345,6 +349,7 @@ export const authLoginServiceFactory = ({isEmailVerified,aliasId,organizationId,+ idpMfaOrgId,callbackPort,email: user.email,firstName: user.firstName,@@ -363,7 +368,7 @@ export const authLoginServiceFactory = ({ip,userAgent,authMethod,- idpMfaOrgId: idpMfa?.verified ? organizationId : undefined+ idpMfaOrgId});if (organizationId) {diff --git a/backend/src/services/auth/auth-signup-service.ts b/backend/src/services/auth/auth-signup-service.tsindex 49257450d4..3ca50ecd2e 100644--- a/backend/src/services/auth/auth-signup-service.ts+++ b/backend/src/services/auth/auth-signup-service.ts@@ -404,7 +404,8 @@ export const authSignupServiceFactory = ({ip: dto.ip,userAgent: dto.userAgent,authMethod,- organizationId+ organizationId,+ idpMfaOrgId: decodedToken.idpMfaOrgId});return {diff --git a/backend/src/services/auth/auth-type.ts b/backend/src/services/auth/auth-type.tsindex d0f0b07922..696537a207 100644--- a/backend/src/services/auth/auth-type.ts+++ b/backend/src/services/auth/auth-type.ts@@ -162,6 +162,7 @@ export type AuthModeSignUpTokenPayload = {isEmailVerified: boolean;aliasId?: string;organizationId?: string;+ idpMfaOrgId?: string;callbackPort?: string;// User profile fields for the frontend signup pageemail?: string;