Commit d0842d20 authored by Alexis Reigel's avatar Alexis Reigel Committed by Alexis Reigel

disallow group runners to become project runners

parent 4b1b2f3b
...@@ -206,6 +206,7 @@ module API ...@@ -206,6 +206,7 @@ module API
def authenticate_enable_runner!(runner) def authenticate_enable_runner!(runner)
forbidden!("Runner is shared") if runner.is_shared? forbidden!("Runner is shared") if runner.is_shared?
forbidden!("Runner is locked") if runner.locked? forbidden!("Runner is locked") if runner.locked?
forbidden!("Runner is a group runner") if runner.group?
return if current_user.admin? return if current_user.admin?
forbidden!("No access granted") unless user_can_access_runner?(runner) forbidden!("No access granted") unless user_can_access_runner?(runner)
......
...@@ -658,6 +658,12 @@ describe API::Runners do ...@@ -658,6 +658,12 @@ describe API::Runners do
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(403)
end 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 context 'user is admin' do
it 'enables any specific runner' do it 'enables any specific runner' do
expect do expect do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment