Repository navigation
Conversation
charIeszhao
left a comment
There was a problem hiding this comment.
Two findings from the MFA compatibility review.
022bc49 to
5d03df7
Compare
| await handleError(submitError, { | ||
| ...trustedDeviceRegisterErrorHandler, | ||
| ...submitErrorHandlers, | ||
| }); |
There was a problem hiding this comment.
The Register trusted-device handler is spread first, so when called from MfaFactorList it's overridden by the SignIn one inside useMfaSubmitErrorHandler, but from the single-factor path in useMfaErrorHandler (which passes only the MFA handlers) it's the one that runs. The same session.trusted_device_suggest_opt_in response then puts a different interactionEvent into the trusted-device state depending on where the user came from.
use-mfa-submit-error-handler.ts notes that MFA binding after registration continues as SignIn. Can we drop the Register handler here and use useMfaSubmitErrorHandler for both callers?
There was a problem hiding this comment.
Switched useTrustedDeviceOptInErrorHandler here to InteractionEvent.SignIn so both callers produce the same SignIn continuation state. Kept the MFA handlers passed via submitErrorHandlers rather than calling useMfaSubmitErrorHandler directly here because useMfaErrorHandler invokes useStartIdentifierMfaBinding, which would otherwise create a circular hook call.
| if ( | ||
| (factor === MfaFactor.EmailVerificationCode || | ||
| factor === MfaFactor.PhoneVerificationCode) && | ||
| flow === UserMfaFlow.MfaBinding | ||
| ) { | ||
| return startIdentifierMfaBinding(factor, state); | ||
| } |
There was a problem hiding this comment.
With a single available factor this now starts the binding right away. In Register (Mandatory + Explicit with only email/phone configured, or WebAuthn filtered out in a native webview) and a verified registration code, the factor is enrolled and the interaction submitted without any MFA screen, so the user never sees that email MFA was turned on, nor a skip button when it's skippable. Previously this navigated to the binding page.
Is that the intended UX?
There was a problem hiding this comment.
Yes, this is intended: (1) when MFA is skippable (non-mandatory policies), Core throws user.suggest_mfa (/mfa-onboarding with Enable + Skip) before reaching user.missing_mfa, so the user never loses the skip choice; (2) under non-skippable Mandatory policies with only a single usable factor, SignIn needs startIdentifierMfaBinding to send the code and obtain verificationId before rendering the code input (matching startTotpBinding / startWebAuthnProcessing), and in Register reusing the just-verified registration code completes mandatory enrollment without a redundant screen, matching Implicit mode.
- Reuse verified registration code records when enrolling the same identifier during sign-up, or send a subject-bound primary verification code. - Render ExistingIdentifierCodeVerification when maskedIdentifiers is present and use boundFactors in MfaFactorList to keep unenrolled identifiers active. Implements LOG-14721.
- Share isFactorBoundInSuggestion across MfaFactorList, useMfaErrorHandler, and useStartIdentifierMfaBinding so single-factor suggestions left after WebView WebAuthn filtering land on /mfa-binding instead of re-enrolling. - Exercise real redirect and identifier-binding hooks together in tests.
…llback - Share sendSubjectVerificationCode and verifySubjectVerificationCode between step-up and MFA binding APIs, and reuse MfaCodeVerification for existing identifier code entry instead of a duplicate component. - Fall back to sending a primary code only on email/phone_exists_in_profile errors, and align trusted-device opt-in continuation on SignIn.
21dfd96 to
bba0ba8
Compare
2be5da0 to
7984423
Compare
Summary
Implements LOG-14721, PR 2c of "MFA: Explicit email/SMS factor enrollment" (stacked on #10032).
useStartIdentifierMfaBindingand Experience MFA / shared subject-verification-code API helpers to reuse a verified registration verification-code record when enrolling that same identifier during sign-up without sending a second code, or otherwise send a subject-bound primary verification code before navigating to/mfa-binding/<factor>.MfaCodeVerification(withbindMfaByVerificationCodeandsendSubjectVerificationCode) on/mfa-binding/EmailVerificationCodeand/mfa-binding/PhoneVerificationCodewhenmaskedIdentifiersis present (preservingIdentifierProfileFormwhen absent), and useboundFactorsinMfaFactorListso unenrolled existing primary identifiers remain selectable onsession.mfa.suggest_additional_mfa.Testing
Tested locally, Unit tests
Checklist
.changeset