2FA User page sometimes returns a 500 error

Summary

When removing and adding a 2FA device, the page sometimes returns a 500 error.

Steps to reproduce

  1. Go to the 2FA User page
  2. Enter password and click on "Disable two-factor authentication"
  3. When the page loads, click on the blue "Enable two-factor authentication" button
  4. See 500 error

Example Project

N/A

What is the current bug behavior?

500 error is returned

What is the expected correct behavior?

Page properly loads.

Relevant logs and/or screenshots

https://log.gprd.gitlab.net/goto/88a64880-0d7f-11ed-b86b-d963a1a6788e correlation ID - 01G8Z8W71EGQ5NEHS3NC0WZTBP

Profiles::TwoFactorAuthsController
undefined method `scan' for nil:NilClass

Output of checks

This bug happens on GitLab.com 15.3.0-pre a10c9621

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Assignee Loading
Time tracking Loading