Skip to content

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

allow always editing the mfa trust

Thiago Araujo da Silva2dfe6b4e83b3
diff --git a/backend/AGENTS.md b/backend/AGENTS.md
index 2a803c58d6..cd4552c05e 100644
--- a/backend/AGENTS.md
+++ b/backend/AGENTS.md
@@ -321,10 +321,9 @@ through `isIdpMfaTrusted` (`auth-fns.ts`), the only reader of the setting. Rules
- 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, and like `authEnforced` it needs `Sso.Edit`, not just
- `Settings.Edit`.
+ org that does not enforce it is still prompted. Like the admin SSO bypass, the setting can be stored at any
+ time, before enforcement is on or before any SSO config exists; `updateOrg` only requires the plan to allow
+ MFA enforcement for `signal`, and like `authEnforced` it needs `Sso.Edit`, not just `Settings.Edit`.
- `isMfaVerified` is never set from the IdP. It still means "proved a factor to Infisical", so step-up
(`mfa-step-up-fns.ts`) and PAM MFA are unaffected. OAuth consent (`authorizeConsent`) re-derives the MFA
requirement for the client's org and applies the same `isIdpMfaTrusted` waiver, so a session that skipped
diff --git a/backend/e2e-test/routes/v3/auth-mfa.spec.ts b/backend/e2e-test/routes/v3/auth-mfa.spec.ts
index 6080f4fef2..231410c600 100644
--- a/backend/e2e-test/routes/v3/auth-mfa.spec.ts
+++ b/backend/e2e-test/routes/v3/auth-mfa.spec.ts
@@ -311,11 +311,11 @@ describe("Auth MFA V3", () => {
}
});
- test("the setting cannot be turned on without an active SSO configuration", async () => {
+ test("the setting can be turned on before any SSO configuration exists, like the bypass toggle", async () => {
const res = await updateOrg({ ssoMfaTrust: SsoMfaTrust.Signal });
- expect(res.statusCode).toBe(400);
- expect(res.json().message).toMatch(/SAML or OIDC/);
+ expect(res.statusCode).toBe(200);
+ expect(res.json().organization.ssoMfaTrust).toBe(SsoMfaTrust.Signal);
});
test("the signal also covers personal MFA when the org enforces it", async () => {
diff --git a/backend/src/services/org/org-service.ts b/backend/src/services/org/org-service.ts
index 229dd4a687..f32c8c9f43 100644
--- a/backend/src/services/org/org-service.ts
+++ b/backend/src/services/org/org-service.ts
@@ -593,20 +593,11 @@ export const orgServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionSsoActions.Edit, OrgPermissionSubjects.Sso);
}
- if (ssoMfaTrust !== undefined && ssoMfaTrust !== SsoMfaTrust.None) {
- if (!plan.enforceMfa) {
- throw new BadRequestError({
- message:
- "Failed to update MFA for SSO logins due to plan restriction. Upgrade plan to trust identity provider MFA."
- });
- }
-
- if (!currentOrg.orgAuthMethod) {
- throw new BadRequestError({
- message:
- "Trusting the identity provider's MFA signal requires an active SAML or OIDC SSO configuration. Set up SSO first."
- });
- }
+ if (ssoMfaTrust !== undefined && ssoMfaTrust !== SsoMfaTrust.None && !plan.enforceMfa) {
+ throw new BadRequestError({
+ message:
+ "Failed to update MFA for SSO logins due to plan restriction. Upgrade plan to trust identity provider MFA."
+ });
}
if (authEnforced !== undefined) {
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
index fd7e535fcb..0c5a34cdb6 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
@@ -375,7 +375,7 @@ export const OrgGeneralAuthSection = ({
)}
</div>
- <SsoMfaTrustField isSsoActive={isSamlActive || isOidcActive} />
+ <SsoMfaTrustField />
</FieldGroup>
</CardContent>
</Card>
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SsoMfaTrustField.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SsoMfaTrustField.tsx
index ab28f42612..2106684070 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SsoMfaTrustField.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SsoMfaTrustField.tsx
@@ -22,15 +22,12 @@ import { useUpdateOrg } from "@app/hooks/api";
import { SsoMfaTrust } from "@app/hooks/api/organization/types";
import { usePopUp } from "@app/hooks/usePopUp";
-type Props = {
- isSsoActive: boolean;
-};
-
-export const SsoMfaTrustField = ({ isSsoActive }: Props) => {
+export const SsoMfaTrustField = () => {
const { currentOrg } = useOrganization();
const { subscription } = useSubscription();
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
const { mutateAsync } = useUpdateOrg();
+ const isTrustOn = currentOrg?.ssoMfaTrust === SsoMfaTrust.Signal;
const handleToggle = async (value: boolean) => {
if (!currentOrg?.id) return;
@@ -77,9 +74,9 @@ export const SsoMfaTrustField = ({ isSsoActive }: Props) => {
<Toggle
id="trust-idp-mfa"
variant="org"
- checked={currentOrg?.ssoMfaTrust === SsoMfaTrust.Signal}
+ checked={isTrustOn}
onCheckedChange={handleToggle}
- disabled={!isAllowed || !isSsoActive}
+ disabled={!isAllowed}
/>
)}
</OrgPermissionCan>