Importing templates via include:file requires that user pushing change has access to template repository

Summary

If a gitlab-ci pipeline contains a reference to a template in a repository I personally haven't got access to the pipeline fails with an error indicating the yml is invalid.

Steps to reproduce

  1. Create two source repositories, one containing a template and one a pipeline referencing the pipeline
  2. Add another user (developer)
  3. Give access to the pipeline repo to the developer user
  4. Trigger a run of the pipeline with the developer user

Example Project

What is the current bug behavior?

The pipeline fails if a developer pushes code and the pipeline references a protected template.

The end result of this is that there can not be 'protected' pipelines where only administrators are available to see the what is going on (thats actually not a bad thing, but compliance and audit thinks keeping secrets is a good thing) It also results in increased administration as users need access to more repositories.

What is the expected correct behavior?

The template should be accessed by gitlab runner credentials, not the developer initiating the code push

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.5.3p105
Gem Version:	2.7.6
Bundler Version:1.16.6
Rake Version:	12.3.2
Redis Version:	3.2.12
Git Version:	2.18.1
Sidekiq Version:5.2.3
Go Version:	unknown
GitLab information
Version:	11.7.0-ee
Revision:	c02f0d4
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	postgresql
DB Version:	9.6.11
URL:		http://gitlab.mrgreen.tech
HTTP Clone URL:	http://gitlab.mrgreen.tech/some-group/some-project.git
SSH Clone URL:	git@gitlab.mrgreen.tech:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	yes
Using Omniauth:	yes
Omniauth Providers:
GitLab Shell
Version:	8.4.4
Repository storage paths:

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 >= 8.4.4 ? ... OK (8.4.4) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK Access to /var/opt/gitlab/.ssh/authorized_keys: 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 ..... 100 FIRST LDAP ACCOUNTS HERE ..... LDAP authentication... Success 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: ... 4/1 ... yes 4/2 ... yes 3/3 ... yes 5/4 ... yes 8/5 ... yes 20/6 ... yes 12/7 ... yes 12/8 ... yes 11/9 ... yes 19/11 ... yes 17/12 ... yes 11/13 ... yes 12/14 ... yes 22/15 ... yes 22/16 ... yes 22/17 ... yes 22/18 ... yes 22/19 ... yes 4/20 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 11 Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled) Checking GitLab App ... Finished Checking GitLab subtasks ... Finished

Possible fixes

Edited Jul 27, 2020 by Jason Yavorsky
Assignee Loading
Time tracking Loading