Skip to content

feat(mfa): add --disable-mfa one-way global kill switch#684

Merged
lakhansamani merged 1 commit into
mainfrom
feat/disable-mfa-killswitch
Jul 12, 2026
Merged

feat(mfa): add --disable-mfa one-way global kill switch#684
lakhansamani merged 1 commit into
mainfrom
feat/disable-mfa-killswitch

Conversation

@lakhansamani

Copy link
Copy Markdown
Contributor

Adds a single flag to globally disable MFA, answering "how do I turn MFA off entirely?".

Why

After #682, EnableMFA is 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 (default false) is a one-way kill switch. In config.Finalize(), when set it forces EnableMFA = false and EnforceMFA = false, regardless of the per-method flags.
  • One-way by design: it can only ever turn MFA off, so — unlike the removed --enable-mfa — it can't contradict the per-method flags or reintroduce the "enabled but no usable method" bug (S1685).
  • Neutralizing EnforceMFA too prevents signup from flagging users for an MFA they could never complete.
  • Does not affect WebAuthn/passkey — that's a separate login recipe (WebauthnLoginVerify issues tokens directly and is not part of the EnableMFA derivation).

Tests

Extended TestFinalizeMFADerivation with a kill-switch case (per-method flags still derive true, but EnableMFA is forced false). Build + gofmt + config unit tests green; --disable-mfa shows in --help.

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.
@lakhansamani lakhansamani merged commit 49d1c5e into main Jul 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant