403 for /project variables endpoint for archived projects

Summary

/project/#/variables endpoint returns a 403 for archived projects.

https://docs.gitlab.com/ee/api/project_level_variables.html#list-project-variables

Archiving makes a project read only. Using GET on the variables endpoint on a project should return the expected values as documented in the page above. However, 403 is returned when a project is archived instead.

Steps to reproduce

  1. Archive a project
  2. Try GET /projects/:id/variables or GET /projects/:id/variables/:key endpoints with the correct access token.
  3. Return is {"message":"403 Forbidden"}

What is the current bug behavior?

403 is returned

What is the expected correct behavior?

Return project CICD variables on archived project.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Gitlab saas

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

See #399327 (comment 1682125084)

Edited by 🤖 GitLab Bot 🤖