allow self-hosted runner to be restricted to container builds only
See original GitHub issueDescribe the enhancement Right now the security recommendation for self-hosted runners is not to host them on machines where there is any sensitive data. Because third party code can be injected via pull-requests.
It would be nice if self-hosted runner could be configured in a way to accept only jobs which have container:
attribute, i.e. only jobs running inside of a docker container. This would allow to host such runners on machines without being afraid for sensitive data. I.e. if third party pull request modifies the workflow by removing the container:
attribute then the job will be failed by the self-hosted runner.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:6
Top Results From Across the Web
About self-hosted runners
A self-hosted runner is a system that you deploy and manage to execute jobs from GitHub Actions on GitHub.com. For more information about...
Read more >Self-Hosted GitHub Runners Are Backdoors
Configure self-hosted runners at the repository level and not the organization for any repositories containing more sensitive source code.
Read more >Is the GitHub Actions self-hosted runner safe for Open Source?
GitHub warns against using self-hosted Actions runners for public repositories - but why? And are there alternatives?
Read more >GitHub Actions - Self-hosted runners - Installation & Calling
When using GitHub Actions, you have the option to use GitHub hosted runners, or to run your own runners, called self - hosted...
Read more >Securing Your CI/CD Pipeline: Exploring the Dangers of ...
Self -hosted runners can be physical, virtual, in a container, on-premises, or in a cloud environment. The alternative is to use a build-as-a-service...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Disclaimer: I’m not a GitHub employee.
This sounds good but unfortunately wouldn’t work, at least without very big redesigns. Docker containers, at least they way GitHub Actions uses them, don’t provide that level of isolation. Here’s a dumb example:
The job runs inside a container. The first
poweroff -f
will fail with this error:but to make
uses:
work (which often launches containers) GitHub Actions mounts/var/run/docker.sock
into the jobs container. This socket lets your docker client communicate with the outside host e.g. to launch containers. So any containers used inuses:
run adjacent to your job container, not inside it. Maybe this sounds weird, but Docker unfortunately wasn’t built for nesting (even if some of the technologies like cgroups and namespaces are).A big consequence of being able to run containers on the host like this is that you’re effectively unsandboxed. Here we run a container with
--privlieged
and can actually power off the machine (theecho hello
will never run.)But you can do whatever, really. You could mount the root volume and read any file from the host, etc.
So how do you get sandboxing with GitHub Actions? The usual boring way: run one job per VM (tear down the VM after the job is done – #510 is needed to make this good as far as I know) and don’t make the VM’s more privileged than you need (e.g. if you’re running in AWS, pay mind to what VPC they’re running in and what their instance role is.)
TL;DR: job containers aren’t a security feature.
@j3parker I tried to use rootless docker to avoid your poweroff scenario from above, but, alas, this won’t work either because of https://github.com/actions/runner/issues/827