Skip to content

Bug 2059948 - Do not offer recovery codes to Duo users - #2723

Open
loganrosen wants to merge 1 commit into
mozilla:masterfrom
loganrosen:loganrosen-fix-bug-2059948
Open

Bug 2059948 - Do not offer recovery codes to Duo users#2723
loganrosen wants to merge 1 commit into
mozilla:masterfrom
loganrosen:loganrosen-fix-bug-2059948

Conversation

@loganrosen

Copy link
Copy Markdown
Contributor

BMO recovery codes only work with TOTP, but Duo users could still generate them from their MFA preferences.

This change makes recovery-code support an explicit MFA provider capability, enables it for TOTP only, and hides the recovery-code controls for Duo accounts. Server-side checks reject forged recovery requests, including requests that spoof TOTP as the provider. The two-factor authentication guide now documents recovery codes as TOTP-only.

Tests:

  • t/001compile.t t/004template.t t/005whitespace.t t/012throwables.t
  • qa/t/2_test_login_duo.t
  • qa/t/2_test_login_totp.t
  • Sphinx documentation build (changed page succeeds; existing unrelated warnings remain)

https://bugzilla.mozilla.org/show_bug.cgi?id=2059948

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 23, 2026 01:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restricts BMO recovery-code generation to TOTP accounts and rejects forged requests for unsupported MFA providers.

Changes:

  • Adds an explicit recovery-code capability enabled only for TOTP.
  • Hides Duo recovery controls and adds server-side enforcement.
  • Adds Duo regression coverage and updates documentation.
Show a summary per file
File Description
userprefs.cgi Validates recovery requests against the account’s provider.
Bugzilla/MFA.pm Defines and enforces the provider capability.
Bugzilla/MFA/TOTP.pm Enables recovery codes for TOTP.
template/en/default/account/prefs/mfa.html.tmpl Conditionally displays recovery controls.
template/en/default/global/user-error.html.tmpl Adds the unsupported-provider error.
qa/t/2_test_login_duo.t Tests hidden controls and forged requests.
docs/en/rst/using/two-factor-authentication.rst Documents recovery codes as TOTP-only.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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.

2 participants