/group/project/container_registry.json does not support Private-Tokens anymore

Summary

Since the last major version (11.5), our registry cleaning scripts does not works anymore since the /group/project/container_registry.json endpoints does not accepts Private-Token anymore.

Steps to reproduce

Call the /group/project/container_registry.json endpoint with a Private-Token and you'll get :

{
    "error": "You need to sign in or sign up before continuing."
}

What is the current bug behavior?

Receiving a 401 with body:

{
    "error": "You need to sign in or sign up before continuing."
}

What is the expected correct behavior?

A list of entries like this:

[{"id":123,"path":"group/project/imageName","location":"http://.../group/project/imageName","tags_path":"/group/project/registry/repository/45/tags?format=json","destroy_path":"/group/project/container_registry/123.json"} ]

Relevant logs and/or screenshots

Started GET "/group/project/container_registry.json" for 10.251.3.20 at 2018-12-11 12:28:42 +0000
Processing by Projects::Registry::RepositoriesController#index as JSON
  Parameters: {"namespace_id"=>"group", "project_id"=>"project"}
Completed 401 Unauthorized in 7ms (ActiveRecord: 0.0ms)

Output of checks

N/A

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:		Debian 8.7
Current User:	git
Using RVM:	no
Ruby Version:	2.4.5p335
Gem Version:	2.7.6
Bundler Version:1.16.6
Rake Version:	12.3.1
Redis Version:	3.2.12
Git Version:	2.18.1
Sidekiq Version:5.2.1
Go Version:	unknown

GitLab information Version: 11.5.3 Revision: aa11737 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://xxx.be HTTP Clone URL: https://xxx.be/some-group/some-project.git SSH Clone URL: ssh://git@xxx.be:2233/some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: azure_oauth2

GitLab Shell Version: 8.4.1 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

N/A

Possible fixes

Temp workaround: https://gitlab.com/snippets/1789835

Edited by Romain Cambier