Apply allowed_users to Docker service containers

Why

A Docker service container could run as a user the runner administrator had not allowed. The build container path checks services[].docker.user against allowed_users; the service container path did not.

What changes

createService rejects a service user not in allowed_users before the service image is pulled, failing the job with a configuration error. Only an explicit allowed_users list applies — services have never run as the runner's user setting, so a runner with only user set keeps accepting any service user.

Testing

TestDockerServiceUserAllowed — allowed user accepted; disallowed user rejected before pull with a configuration error.

Related to gitlab-org/gitlab#607165

Edited by Daniel Keenan

Merge request reports

Loading
Loading