undefined method `sudo_scope_authentication_abilities' for Gitlab::Auth:Module

Summary

Possible regression in GitLab 10.2.0:

undefined method `sudo_scope_authentication_abilities' for Gitlab::Auth:Module when trying to login on the integrated registry.

Steps to reproduce

  • Update GitLab to 10.2.0
  • Try to login (we're using 2FA for the record)
docker login -u [username] [gitlab-registry-url]
Password:
Error response from daemon: Get https://registry:5005/v2/: received unexpected HTTP status: 500 Internal Server Error

What is the current bug behavior?

Can't login anymore

What is the expected correct behavior?

Login successful, and being able to push/pull images.

Relevant logs and/or screenshots

==> /var/log/gitlab/gitlab-rails/production.log <==
Started GET "/jwt/auth?account=gravis&client_id=docker&offline_token=[FILTERED]&service=container_registry" for 1.2.3.4 at 2017-11-22 22:11:28 +0000
Processing by JwtController#auth as HTML
  Parameters: {"account"=>"gravis", "client_id"=>"docker", "offline_token"=>"[FILTERED]", "service"=>"container_registry"}
Completed 500 Internal Server Error in 15ms (ActiveRecord: 1.2ms)

==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"GET","path":"/jwt/auth","format":"html","controller":"JwtController","action":"auth","status":500,"error":"NoMethodError: undefined method `sudo_scope_authentication_abilities' for Gitlab::Auth:Module","duration":16.5,"view":0.0,"db":1.15,"time":"2017-11-22T22:11:28.168Z","params":{"account":"gravis","client_id":"docker","offline_token":"[FILTERED]","service":"container_registry"},"remote_ip":"172.16.3.22","user_id":null,"username":null}

==> /var/log/gitlab/gitlab-rails/production.log <==

NoMethodError (undefined method `sudo_scope_authentication_abilities' for Gitlab::Auth:Module):
  lib/gitlab/auth.rb:145:in `public_send'
  lib/gitlab/auth.rb:145:in `block in abilities_for_scope'
  lib/gitlab/auth.rb:144:in `map'
  lib/gitlab/auth.rb:144:in `abilities_for_scope'
  lib/gitlab/auth.rb:131:in `personal_access_token_check'
  lib/gitlab/auth.rb:30:in `find_for_git_client'
  app/controllers/jwt_controller.rb:26:in `block in authenticate_project_or_user'
  app/controllers/jwt_controller.rb:25:in `authenticate_project_or_user'
  lib/gitlab/i18n.rb:47:in `with_locale'
  lib/gitlab/i18n.rb:53:in `with_user_locale'
  app/controllers/application_controller.rb:336:in `set_locale'
  lib/gitlab/middleware/multipart.rb:93:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  lib/gitlab/middleware/go.rb:18:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/middleware/read_only.rb:31:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

root@8a5c528c8d9f:/# gitlab-rake gitlab:env:info

System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.3.5p376
Gem Version:    2.6.13
Bundler Version:1.13.7
Rake Version:   12.1.0
Redis Version:  3.2.5
Git Version:    2.13.6
Sidekiq Version:5.0.4
Go Version:     unknown

GitLab information
Version:        10.2.0
Revision:       8905c47
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            https://private-gitlab
HTTP Clone URL: https://private-gitlab/some-group/some-project.git
SSH Clone URL:  git@private-gitlab:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        5.9.4
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git

Results of GitLab application Check

No errors reported.

Possible fixes

No idea so far

Edited by Philippe Lafoucrière