Skip to content

Commit 8d00038

Browse files
hubwriterrachaelrenkrentziassSiaraMistgithub-actions
authored
Actions: disabling repository-level self-hosted runners (#37170)
Co-authored-by: Rachael Rose Renk <[email protected]> Co-authored-by: Francesco Renzi <[email protected]> Co-authored-by: Siara <[email protected]> Co-authored-by: github-actions <[email protected]>
1 parent 066997b commit 8d00038

File tree

12 files changed

+114
-1
lines changed

12 files changed

+114
-1
lines changed
Loading

content/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ Untrusted workflows running on your self-hosted runner pose significant security
284284

285285
For more information about security hardening for self-hosted runners, see "[AUTOTITLE](/actions/security-guides/security-hardening-for-github-actions#hardening-for-self-hosted-runners)."
286286

287+
{% ifversion actions-disable-repo-runners %}
288+
289+
### Restricting the use of self-hosted runners
290+
291+
{% data reusables.actions.disable-selfhosted-runners-crossrefs %}
292+
293+
{% endif %}
294+
287295
{% ifversion ghec or ghes or ghae %}
288296

289297
## Further reading

content/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ You can register ephemeral runners that perform a single job before the registra
5252

5353
You can add self-hosted runners to a single repository. To add a self-hosted runner to a user repository, you must be the repository owner. For an organization repository, you must be an organization owner or have admin access to the repository. For information about how to add a self-hosted runner with the REST API, see "[AUTOTITLE](/rest/actions#self-hosted-runners)."
5454

55+
{% ifversion actions-disable-repo-runners %}
56+
57+
{% note %}
58+
59+
**Note**: {% data reusables.actions.disable-selfhosted-runners-crossrefs %}
60+
61+
{% endnote %}
62+
63+
{% endif %}
64+
5565
{% data reusables.repositories.navigate-to-repo %}
5666
{% data reusables.repositories.sidebar-settings %}
5767
{% data reusables.repositories.settings-sidebar-actions-runners %}

content/actions/hosting-your-own-runners/managing-self-hosted-runners/monitoring-and-troubleshooting-self-hosted-runners.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ shortTitle: Monitor & troubleshoot
1818

1919
{% data reusables.actions.enterprise-github-hosted-runners %}
2020

21+
{% ifversion actions-disable-repo-runners %}
22+
23+
## Using repository-level self-hosted runners
24+
25+
You may not be able to create a self-hosted runner for an organization-owned repository.
26+
27+
{% data reusables.actions.disable-selfhosted-runners-crossrefs %}
28+
29+
{% endif %}
30+
2131
## Checking the status of a self-hosted runner
2232

2333
{% data reusables.actions.self-hosted-runner-management-permissions-required %}

content/actions/security-guides/security-hardening-for-github-actions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ SBOMs are available for Ubuntu, Windows, and macOS runner images. You can locate
307307

308308
{% ifversion fpt or ghec %}As a result, self-hosted runners should almost [never be used for public repositories](/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#self-hosted-runner-security) on {% data variables.product.product_name %}, because any user can open pull requests against the repository and compromise the environment. Similarly, be{% elsif ghes or ghae %}Be{% endif %} cautious when using self-hosted runners on private or internal repositories, as anyone who can fork the repository and open a pull request (generally those with read access to the repository) are able to compromise the self-hosted runner environment, including gaining access to secrets and the `GITHUB_TOKEN` which, depending on its settings, can grant write access to the repository. Although workflows can control access to environment secrets by using environments and required reviews, these workflows are not run in an isolated environment and are still susceptible to the same risks when run on a self-hosted runner.
309309

310+
{% ifversion actions-disable-repo-runners %}
311+
312+
{% data reusables.actions.disable-selfhosted-runners-crossrefs %}
313+
314+
{% endif %}
315+
310316
When a self-hosted runner is defined at the organization or enterprise level, {% data variables.product.product_name %} can schedule workflows from multiple repositories onto the same runner. Consequently, a security compromise of these environments can result in a wide impact. To help reduce the scope of a compromise, you can create boundaries by organizing your self-hosted runners into separate groups. You can restrict what {% ifversion restrict-groups-to-workflows %}workflows, {% endif %}organizations and repositories can access runner groups. For more information, see "[AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups)."
311317

312318
You should also consider the environment of the self-hosted runner machines:

content/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/introducing-github-actions-to-your-enterprise.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ You may need to upgrade the CPU and memory resources for {% data variables.locat
8787

8888
{% ifversion ghec %}If you are using self-hosted runners, you have to decide whether you want to use physical machines, virtual machines, or containers.{% else %}Decide whether you want to use physical machines, virtual machines, or containers for your self-hosted runners.{% endif %} Physical machines will retain remnants of previous jobs, and so will virtual machines unless you use a fresh image for each job or clean up the machines after each job run. If you choose containers, you should be aware that the runner auto-updating will shut down the container, which can cause workflows to fail. You should come up with a solution for this by preventing auto-updates or skipping the command to kill the container.
8989

90-
You also have to decide where to add each runner. You can add a self-hosted runner to an individual repository, or you can make the runner available to an entire organization or your entire enterprise. Adding runners at the organization or enterprise levels allows sharing of runners, which might reduce the size of your runner infrastructure. You can use policies to limit access to self-hosted runners at the organization and enterprise levels by assigning groups of runners to specific repositories or organizations. For more information, see "[AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners)" and "[AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups)."
90+
You also have to decide where to add each runner. You can add a self-hosted runner to an individual repository, or you can make the runner available to an entire organization or your entire enterprise. Adding runners at the organization or enterprise levels allows sharing of runners, which might reduce the size of your runner infrastructure. You can use policies to limit access to self-hosted runners at the organization and enterprise levels by assigning groups of runners to specific repositories or organizations. For more information, see "[AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners)" and "[AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups)." {% ifversion actions-disable-repo-runners %}You can also use policies to prevent people using repository-level self-hosted runners. For more information, see "[AUTOTITLE](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#disabling-repository-level-self-hosted-runners)."{% endif %}
9191

9292
{% ifversion ghec or ghes %}
9393
You should consider using autoscaling to automatically increase or decrease the number of available self-hosted runners. For more information, see "[AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/autoscaling-with-self-hosted-runners)."

content/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,32 @@ You can choose to disable {% data variables.product.prodname_actions %} for all
5959
{% data reusables.enterprise-accounts.actions-tab %}
6060
1. Under "Policies", select {% data reusables.actions.policy-label-for-select-actions-workflows %} and add your required actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %} to the list.
6161

62+
{% ifversion actions-disable-repo-runners %}
63+
64+
## Disabling repository-level self-hosted runners
65+
66+
{% data reusables.actions.disable-selfhosted-runners-overview %} For more information on creating self-hosted runners at the repository level, see "[AUTOTITLE](/enterprise-cloud@latest/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners#adding-a-self-hosted-runner-to-a-repository)."
67+
68+
By default anyone with admin access to a repository can add a self-hosted runner for the repository. The enterprise settings allow you to disable the use of repository-level self-hosted runners across all repositories in your enterprise. If you allow repository-level self-hosted runners for your enterprise, organization owners can choose to allow or prevent creation of repository-level self-hosted runners for some or all repositories in their organization. For more information see, "[AUTOTITLE](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization)."
69+
70+
{% data reusables.actions.disable-selfhosted-runners-note %}
71+
72+
{% data reusables.enterprise-accounts.access-enterprise %}
73+
{% data reusables.enterprise-accounts.policies-tab %}
74+
{% data reusables.enterprise-accounts.actions-tab %}
75+
1. In the "Runners" section, select **Disable for all organizations**.{% ifversion ghec %}
76+
77+
{% note %}
78+
79+
**Note**: Owners of an {% data variables.enterprise.prodname_emu_enterprise %} can also choose to select **Disable in all Enterprise Managed User (EMU) repositories** to restrict runner creation for repositories that are owned by managed user accounts.
80+
81+
{% endnote %}
82+
83+
{% endif %}
84+
1. Click **Save** to apply the change.
85+
86+
{% endif %}
87+
6288
## Enforcing a policy for artifact and log retention in your enterprise
6389

6490
{% data variables.product.prodname_actions %} can store artifact and log files. For more information, see "[AUTOTITLE](/actions/managing-workflow-runs/downloading-workflow-artifacts)."

content/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,42 @@ You can choose to disable {% data variables.product.prodname_actions %} for all
5050
1. Under "Policies", select {% data reusables.actions.policy-label-for-select-actions-workflows %} and add your required actions{% ifversion actions-workflow-policy %} and reusable workflows{% endif %} to the list.
5151
1. Click **Save**.
5252

53+
{% ifversion actions-disable-repo-runners %}
54+
55+
## Limiting the use of self-hosted runners
56+
57+
{% data reusables.actions.disable-selfhosted-runners-overview %}
58+
59+
{% ifversion ghec or ghes %}
60+
61+
{% note %}
62+
63+
**Note**: If your organization belongs to an enterprise, creation of self-hosted runners at the repository level may have been disabled as an enterprise-wide setting. If this has been done, you cannot enable repository-level self-hosted runners in your organization settings. For more information, see "[AUTOTITLE](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise)."
64+
65+
{% endnote %}
66+
67+
{% endif %}
68+
69+
If a repository already has self-hosted runners when you disable their use, these will be listed with the status "Disabled" and they will not be assigned any new workflow jobs.
70+
71+
![Screenshot of the "Runners" list showing a self-hosted runner with the status "Disabled."](/assets/images/help/actions/actions-runners-disabled.png)
72+
73+
{% data reusables.actions.disable-selfhosted-runners-note %}
74+
75+
{% data reusables.profile.access_org %}
76+
{% data reusables.profile.org_settings %}
77+
{% data reusables.organizations.settings-sidebar-actions-general %}
78+
1. Under "Runners," use the dropdown menu to choose your preferred setting:
79+
- **All repositories** - self-hosted runners can be used for any repository in your organization.
80+
- **Selected repositories** - self-hosted runners can only be used for the repositories you select.
81+
- **Disabled** - self-hosted runners cannot be created at the repository level.
82+
1. If you choose **Selected repositories**:
83+
1. Click {% octicon "gear" aria-label="Select repositories" %}.
84+
1. Select the check boxes for the repositories for which you want to allow self-hosted runners.
85+
1. Click **Select repositories**.
86+
87+
{% endif %}
88+
5389
{% ifversion fpt or ghec %}
5490
## Configuring required approval for workflows from public forks
5591

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reference: #10198
2+
# Documentation for the ability to disable repo-level self-hosted runners
3+
versions:
4+
fpt: '*'
5+
ghec: '*'
6+
ghes: '>= 3.10'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% ifversion ghec or ghes %}Enterprise owners and organization {% elsif fpt %}Organization {% endif %}owners can disable the ability to create self-hosted runners at the repository level. For more information, see {% ifversion ghec or ghes %}"[AUTOTITLE](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#disabling-repository-level-self-hosted-runners)" and {% endif %}"[AUTOTITLE](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#limiting-the-use-of-self-hosted-runners)."

0 commit comments

Comments
 (0)