Guest CODEOWNERS unable to approve MR

Summary

A user with guest access who's listed in the CODEOWNERS file can't see the Approve button on the merge request page.

This is originally reported by a premium customer (internal link only) and is reproducible in 12.10.7-ee, 12.9.8-ee, and 12.7.0-ee.

Steps to reproduce

  1. Create a new project P.
  2. Add user X as a guest member to project P.
  3. Add user Y as a maintainer member to project P.
  4. Create a CODEOWNERS file mentioning X in the list of approvers.
  5. As user Y, Commit changes to project P and create an MR.
  6. User X will show in the list of approvers.
  7. Impersonate user X.
  8. User X can't see the approve button.

What is the current bug behavior?

The Approve button is not visible for Guests listed in CODEOWNERS.

What is the expected correct behavior?

The Approve button is visible for Guests listed in CODEOWNERS.

Relevant logs and/or screenshots

approvalmissing

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:		Ubuntu 18.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.6.6p146
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.7
Git Version:	2.26.2
Sidekiq Version:5.2.7
Go Version:	unknown

GitLab information
Version:	12.10.7-ee
Revision:	80b99e43cfc
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	11.7
URL:		https://rhassanein.do.gitlap.com
HTTP Clone URL:	https://rhassanein.do.gitlap.com/some-group/some-project.git
SSH Clone URL:	git@rhassanein.do.gitlap.com:some-group/some-project.git
Elasticsearch:	yes
Geo:		no
Using LDAP:	yes
Using Omniauth:	yes
Omniauth Providers: 

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

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 12.2.0 ? ... OK (12.2.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... Server: ldapmain Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead. Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead. Could not connect to the LDAP server: Connection refused - connect(2) for 127.0.0.1:389

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 1/1 ... yes 7/2 ... yes 7/3 ... yes 7/4 ... yes 7/5 ... yes 7/6 ... yes 7/7 ... yes 7/8 ... yes 7/9 ... yes 7/10 ... yes 8/11 ... yes 8/12 ... yes 8/13 ... yes 8/14 ... yes 1/15 ... yes 7/16 ... yes 1/17 ... yes 6/18 ... yes 1/20 ... yes 1/21 ... yes 1/30 ... yes 1/31 ... yes 1/32 ... yes 1/33 ... yes 1/34 ... yes 14/35 ... yes 17/36 ... yes 1/37 ... yes 1/38 ... yes 27/39 ... yes 29/40 ... yes 30/41 ... yes 32/42 ... yes 34/43 ... yes 36/44 ... yes 38/45 ... yes 40/46 ... yes 42/47 ... yes 44/48 ... yes 45/49 ... yes 47/50 ... yes 49/51 ... yes 51/52 ... yes 53/53 ... yes 1/54 ... yes 1/55 ... yes 1/56 ... yes 1/57 ... yes 55/58 ... yes 1/59 ... yes 21/60 ... yes 1/61 ... yes 1/62 ... yes 1/63 ... yes 1/64 ... yes 1/65 ... yes 1/66 ... yes 1/67 ... yes 1/68 ... yes 1/69 ... yes 1/70 ... yes 1/71 ... yes 1/72 ... yes 1/73 ... yes 1/74 ... yes 1/75 ... yes 1/76 ... yes 1/77 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.6) Git version >= 2.22.0 ? ... yes (2.26.2) Git user has default SSH configuration? ... yes Active users: ... 8 Is authorized keys file accessible? ... yes Elasticsearch version 5.6 - 6.x? ... yes (6.8.5)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

Give guest user at least developer access, but that's probably can't be an accpetable workaround in many cases.

Edited by Rehab