Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

update comment

Thiago Araujo da Silvae59ca332349a
diff --git a/backend/AGENTS.md b/backend/AGENTS.md
index 4541976375..e6c90ab54a 100644
--- a/backend/AGENTS.md
+++ b/backend/AGENTS.md
@@ -316,7 +316,10 @@ the only reader of the setting. Rules that must hold:
- The proof only counts for the root org whose IdP produced it. A user in two orgs could otherwise tune one
org's allowlist to accept a single factor and carry that verdict into the other, so the token stores the org
id rather than a boolean and selection requires it to equal the selected root org.
-- The trust only applies while `enforceMfa` is on. A user's own account-level MFA is still prompted. The
+- The trust only applies while `enforceMfa` is on, and then it waives the whole challenge, including the user's
+ personal `isMfaEnabled`: passing an enforced challenge turns that flag on (`Mfa.tsx` calls `activateMfa`), so
+ honoring it would make the trust dead for anyone who ever logged in before it was enabled. Personal MFA in an
+ org that does not enforce it is still prompted. The
setting can be stored before enforcement is turned on; `updateOrg` refuses any value but `none` only while
the org has no active SAML or OIDC config.
- `isMfaVerified` is never set from the IdP. It still means "proved a factor to Infisical", so step-up
diff --git a/backend/e2e-test/routes/v3/auth-mfa.spec.ts b/backend/e2e-test/routes/v3/auth-mfa.spec.ts
index a9ad646a50..4026ffafd0 100644
--- a/backend/e2e-test/routes/v3/auth-mfa.spec.ts
+++ b/backend/e2e-test/routes/v3/auth-mfa.spec.ts
@@ -233,6 +233,18 @@ describe("Auth MFA V3", () => {
expect(res.json().message).toMatch(/SAML or OIDC/);
});
+ test("the signal also covers personal MFA when the org enforces it", async () => {
+ await setSsoMfaTrust(SsoMfaTrust.Signal);
+ await db()(TableName.Users).where({ id: seedData1.id }).update({ isMfaEnabled: true });
+ try {
+ const { payload } = await selectOrg(await signSsoSession(AuthMethod.OKTA_SAML, rootOrgId), rootOrgId);
+
+ expect(payload.isMfaEnabled).toBe(false);
+ } finally {
+ await db()(TableName.Users).where({ id: seedData1.id }).update({ isMfaEnabled: false });
+ }
+ });
+
test("a user's own MFA is still prompted when only the user, not the org, requires it", async () => {
await setSsoMfaTrust(SsoMfaTrust.Signal);
await db()(TableName.Organization).where({ id: rootOrgId }).update({ enforceMfa: false });
diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.ts
index 54dda8bb51..6a160dc879 100644
--- a/backend/src/services/auth/auth-login-service.ts
+++ b/backend/src/services/auth/auth-login-service.ts
@@ -1329,8 +1329,10 @@ export const authLoginServiceFactory = ({
// The MFA policy belongs to the root org, so switching between it and its sub-orgs is not a change.
const hasOrganizationChanged = actorRootOrgId ? actorRootOrgId !== rootOrg.id : false;
const hasMfaMethodChanged = mfaMethod !== requiredMfaMethod;
- // Checked on every selection so turning the trust off applies at the next switch. It only waives the
- // org's enforcement, never MFA a user turned on for their own account.
+ // Checked on every selection so turning the trust off applies at the next switch. While the org enforces
+ // MFA it waives the whole challenge, personal flag included: passing an enforced challenge turns personal
+ // MFA on (the login MFA page activates it), so the two cannot be told apart. Personal MFA in an org that
+ // does not enforce it still prompts.
const isMfaSatisfiedByIdp =
Boolean(rootOrg.enforceMfa) &&
isIdpMfaTrusted({