summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-09-25 15:28:49 +0200
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2018-02-28 09:49:53 +0100
commit892eb3f025dc4425d3bd759db4030b3a26b69cdd (patch)
treee48bb348d437ed42e74605d9fa41a3caa0da6bf2
parent2640235952aee2b873317954488cd9ba5c17a9b3 (diff)
downloadgitlab-ce-892eb3f025dc4425d3bd759db4030b3a26b69cdd.tar.gz
disallow group runners to become project runners
-rw-r--r--lib/api/runners.rb1
-rw-r--r--spec/requests/api/runners_spec.rb6
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 3098b296a27..b28621c357d 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -205,6 +205,7 @@ module API
def authenticate_enable_runner!(runner)
forbidden!("Runner is shared") if runner.is_shared?
forbidden!("Runner is locked") if runner.locked?
+ forbidden!("Runner is a group runner") if runner.group?
return if current_user.admin?
forbidden!("No access granted") unless user_can_access_runner?(runner)
diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb
index 427c60501e0..dd196787034 100644
--- a/spec/requests/api/runners_spec.rb
+++ b/spec/requests/api/runners_spec.rb
@@ -655,6 +655,12 @@ describe API::Runners do
expect(response).to have_gitlab_http_status(403)
end
+ it 'does not enable group runner' do
+ post api("/projects/#{project.id}/runners", user), runner_id: group_runner.id
+
+ expect(response).to have_http_status(403)
+ end
+
context 'user is admin' do
it 'enables any specific runner' do
expect do