feat(mfa): add --disable-mfa one-way global kill switch#684
Merged
Conversation
Operators can turn MFA off entirely with a single flag instead of setting all three --disable-totp-login/--disable-email-otp/--disable-sms-otp. It is one-way: Finalize forces EnableMFA and EnforceMFA off when set, so it can never contradict the per-method flags the way the removed --enable-mfa did. WebAuthn/passkey is a separate login recipe and is unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a single flag to globally disable MFA, answering "how do I turn MFA off entirely?".
Why
After #682,
EnableMFAis derived from the per-method flags, so turning MFA off required setting all three (--disable-totp-login --disable-email-otp --disable-sms-otp). This adds the single affordance operators expect.Behavior
--disable-mfa(defaultfalse) is a one-way kill switch. Inconfig.Finalize(), when set it forcesEnableMFA = falseandEnforceMFA = false, regardless of the per-method flags.--enable-mfa— it can't contradict the per-method flags or reintroduce the "enabled but no usable method" bug (S1685).EnforceMFAtoo prevents signup from flagging users for an MFA they could never complete.WebauthnLoginVerifyissues tokens directly and is not part of theEnableMFAderivation).Tests
Extended
TestFinalizeMFADerivationwith a kill-switch case (per-method flags still derive true, butEnableMFAis forced false). Build +gofmt+ config unit tests green;--disable-mfashows in--help.