Audit log incorrectly records "Signed in with OPENID_CONNECT authentication" event when OpenID Connect authentication fails during Admin Mode entry

Summary

When attempting to enter Admin Mode using OpenID Connect authentication and the authentication fails, the audit log incorrectly records a Signed in with OPENID_CONNECT authentication event, creating confusion about the actual authentication status.

Steps to reproduce

  1. Log in to the root account using username and password.
  2. Click on Admin and you'll be provided with the sign-in form.
  3. Instead of entering the password, click the OpenID Connect sign-in button.
  4. Observe that Admin Mode entry fails becuase root user does not have an OpenID connect identity linked.
  5. Enter admin mode again using password.
  6. Go to Monitoring > Audit events.
  7. Note that a new event was generated: Signed in with OPENID_CONNECT authentication for the failed attempt.

Example Project

What is the current bug behavior?

  • Admin Mode entry fails (correct behavior)
  • Audit log incorrectly records Signed in with OPENID_CONNECT authentication event
  • This creates confusion as it suggests successful authentication when it actually failed

What is the expected correct behavior?

Audit log should either:

  • Not record any authentication event, OR
  • Record a failed authentication attempt with appropriate status

Relevant logs and/or screenshots

Output of checks

Tested on GitLab 18.4.1-ee self-managed.

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

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

Edited by 🤖 GitLab Bot 🤖