Bot users don't have access to internal projects
### Summary A pipeline created with an project access token fails when including a `.gitlab-ci.yml` template from an internal project. ### Steps to reproduce 1. Create a project with 'internal' visibility and create a file `.gitlab-ci.template.yml` to reference as a template. 2. Create another project. In this second project: 1. Create a `.gitlab-ci.yml` which includes the template from the first project similar to this: ``` include: - project: 'path/to/the/internal/project' file: '/.gitlab-ci.template.yml' ``` 2. Create a project access token with `api` and `write_repository` permissions. 3. Trigger a pipeline by pushing a commit using the access token. 4. Also trigger a pipeline as a "regular" user to see it not fail. <!-- TODO ### Example Project If possible, please create an example project here on GitLab.com that exhibits the problematic behavior, and link to it here in the bug report. If you are using an older version of GitLab, this will also determine whether the bug is fixed in a more recent version. --> ### What is the current *bug* behavior? The pipeline triggered by the bot user fails with > Found errors in your .gitlab-ci.yml: > - Project `path/to/the/internal/project` not found or access denied! Make sure any includes in the pipeline configuration are correctly defined. ### What is the expected *correct* behavior? The pipeline is started just like as it would be by a logged in user. Note many reports were not reproducible due to incorrect identification of private vs internal projects however https://gitlab.com/gitlab-org/gitlab/-/issues/361993#note_1674185875 may be helpful in reproduction. <!-- ### Relevant logs and/or screenshots Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise. --> <!-- ### Output of checks If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com --> <!-- #### Results of GitLab environment info Input any relevant GitLab environment information if needed. <details> <summary>Expand for output related to GitLab environment info</summary> <pre> (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`) </pre> </details>--> <!-- #### Results of GitLab application Check Input any relevant GitLab application check information if needed. <details> <summary>Expand for output related to the GitLab application check</summary> <pre> (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) </pre> </details>--> <!-- ### Possible fixes If you can, link to the line of code that might be responsible for the problem. -->
issue