Skip to content

500 error when logging in due to audit event failure: MissingAttributeError: author

@jessieay reported getting a 500 error when she attempted to log in:

AuditEvents::BuildService::MissingAttributeError: author
  from app/services/audit_events/build_service.rb:14:in `initialize'
  from lib/gitlab/audit/auditor.rb:172:in `new'
  from lib/gitlab/audit/auditor.rb:172:in `build_event'
  from lib/gitlab/audit/auditor.rb:92:in `single_audit'
  from lib/gitlab/audit/auditor.rb:58:in `audit'
  from ee/lib/audit/unauthenticated_security_event_auditor.rb:28:in `execute'
  from ee/app/controllers/ee/sessions_controller.rb:71:in `log_failed_login'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:400:in `block in make_lambda'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:236:in `block in halting_and_conditional'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:599:in `block in invoke_after'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:599:in `each'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:599:in `invoke_after'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:132:in `block in run_callbacks'
  from ee/lib/gitlab/ip_address_state.rb:10:in `with'
  from ee/app/controllers/ee/application_controller.rb:45:in `set_current_ip_address'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
  from app/controllers/application_controller.rb:468:in `set_current_admin'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
  from lib/gitlab/session.rb:11:in `with_session'
  from app/controllers/application_controller.rb:459:in `set_session_storage'
  from activesupport (7.0.8) lib/active_support/callbacks.rb:127:in `block in run_callbacks'

The Kibana log entries show a lot of OTP values as a parameter, so I wonder if the issue here pops up whenever 2FA fails. There is no user.login specified for https://gitlab.com/gitlab-org/gitlab/-/blob/2612fe8c240e8ff8fd24d6c945824bcb0c5232f1/ee/app/controllers/ee/sessions_controller.rb#L70?

Presumably this fails because the login failed, and author doesn't exist?

Edited by Stan Hu