Skip to content

Commit a1aad93

Browse files
author
Sarah Edwards
authored
Restrict workflow access to runner groups (github#25463)
1 parent 7832cb5 commit a1aad93

11 files changed

+73
-14
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ For more information about installing and using self-hosted runners, see "[Addin
5151
- Can use cloud services or local machines that you already pay for.
5252
- Are customizable to your hardware, operating system, software, and security requirements.
5353
- Don't need to have a clean instance for every job execution.
54-
- Are free to use with {% data variables.product.prodname_actions %}, but you are responsible for the cost of maintaining your runner machines.
54+
- Are free to use with {% data variables.product.prodname_actions %}, but you are responsible for the cost of maintaining your runner machines.{% ifversion ghec or ghes or ghae %}
55+
- Can be organized into groups to restrict access to specific {% if restrict-groups-to-workflows %}workflows, {% endif %}organizations and repositories. For more information, see "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)."{% endif %}
5556

5657
## Requirements for self-hosted runner machines
5758

content/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ versions:
99
ghae: '*'
1010
ghec: '*'
1111
type: tutorial
12-
shortTitle: Manage runner groups
12+
shortTitle: Manage access to runners
1313
---
1414

1515
{% data reusables.actions.enterprise-beta %}
1616
{% data reusables.actions.enterprise-github-hosted-runners %}
17+
{% data reusables.actions.restrict-runner-workflow-beta %}
1718

1819
## About self-hosted runner groups
1920

@@ -30,9 +31,9 @@ If you use {% data variables.product.prodname_ghe_cloud %}, you can create addit
3031
{% endif %}
3132

3233
{% ifversion ghec or ghes or ghae %}
33-
Self-hosted runner groups are used to control access to self-hosted runners at the organization and enterprise level. Enterprise admins can configure access policies that control which organizations in an enterprise have access to the runner group. Organization admins can configure access policies that control which repositories in an organization have access to the runner group.
34+
Self-hosted runner groups are used to control access to self-hosted runners at the organization and enterprise level. Enterprise owners can configure access policies that control which organizations {% if restrict-groups-to-workflows %}and workflows {% endif %}in an enterprise have access to the runner group. Organization owners can configure access policies that control which repositories{% if restrict-groups-to-workflows %} and workflows{% endif %} in an organization have access to the runner group.
3435

35-
When an enterprise admin grants an organization access to a runner group, organization admins can see the runner group listed in the organization's self-hosted runner settings. The organizations admins can then assign additional granular repository access policies to the enterprise runner group.
36+
When an enterprise owner grants an organization access to a runner group, organization owners can see the runner group listed in the organization's self-hosted runner settings. The organization owners can then assign additional granular repository{% if restrict-groups-to-workflows %} and workflow{% endif %} access policies to the enterprise runner group.
3637

3738
When new runners are created, they are automatically assigned to the default group. Runners can only be in one group at a time. You can move runners from the default group to another group. For more information, see "[Moving a self-hosted runner to a group](#moving-a-self-hosted-runner-to-a-group)."
3839

@@ -42,13 +43,14 @@ All organizations have a single default self-hosted runner group. Organizations
4243

4344
Self-hosted runners are automatically assigned to the default group when created, and can only be members of one group at a time. You can move a runner from the default group to any group you create.
4445

45-
When creating a group, you must choose a policy that defines which repositories have access to the runner group.
46+
When creating a group, you must choose a policy that defines which repositories{% if restrict-groups-to-workflows %} and workflows{% endif %} have access to the runner group.
4647

4748
{% ifversion ghec or ghes > 3.3 or ghae-issue-5091 %}
4849
{% data reusables.organizations.navigate-to-org %}
4950
{% data reusables.organizations.org_settings %}
5051
{% data reusables.actions.settings-sidebar-actions-runner-groups %}
5152
1. In the "Runner groups" section, click **New runner group**.
53+
1. Enter a name for your runner group.
5254
{% data reusables.actions.runner-group-assign-policy-repo %}
5355

5456
{% warning %}
@@ -58,6 +60,7 @@ When creating a group, you must choose a policy that defines which repositories
5860
For more information, see "[About self-hosted runners](/actions/hosting-your-own-runners/about-self-hosted-runners#self-hosted-runner-security-with-public-repositories)."
5961

6062
{% endwarning %}
63+
{% data reusables.actions.runner-group-assign-policy-workflow %}{%- if restrict-groups-to-workflows %} Organization-owned runner groups cannot access workflows from a different organization in the enterprise; instead, you must create an enterprise-owned runner group.{% endif %}
6164
{% data reusables.actions.self-hosted-runner-create-group %}
6265
{% elsif ghae or ghes < 3.4 %}
6366
{% data reusables.organizations.navigate-to-org %}
@@ -88,7 +91,7 @@ When creating a group, you must choose a policy that defines which repositories
8891

8992
## Creating a self-hosted runner group for an enterprise
9093

91-
Enterprises can add their self-hosted runners to groups for access management. Enterprises can create groups of self-hosted runners that are accessible to specific organizations in the enterprise account. Organization admins can then assign additional granular repository access policies to the enterprise runner groups. For information about how to create a self-hosted runner group with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runner-groups).
94+
Enterprises can add their self-hosted runners to groups for access management. Enterprises can create groups of self-hosted runners that are accessible to specific organizations in the enterprise account{% if restrict-groups-to-workflows %} or to specific workflows{% endif %}. Organization owners can then assign additional granular repository{% if restrict-groups-to-workflows %} or workflow{% endif %} access policies to the enterprise runner groups. For information about how to create a self-hosted runner group with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname_actions %} REST API](/rest/reference/actions#self-hosted-runner-groups).
9295

9396
Self-hosted runners are automatically assigned to the default group when created, and can only be members of one group at a time. You can assign the runner to a specific group during the registration process, or you can later move the runner from the default group to a custom group.
9497

@@ -115,17 +118,21 @@ When creating a group, you must choose a policy that defines which organizations
115118

116119
![Add runner group options](/assets/images/help/settings/actions-enterprise-account-add-runner-group-options-ae.png)
117120
{%- endif %}
121+
{% data reusables.actions.runner-group-assign-policy-workflow %}
118122
1. Click **Save group** to create the group and apply the policy.
119123

120124
{% endif %}
121125

122126
## Changing the access policy of a self-hosted runner group
123127

124-
You can update the access policy of a runner group, or rename a runner group.
128+
For runner groups in an enterprise, you can change what organizations in the enterprise can access a runner group{% if restrict-groups-to-workflows %} or restrict what workflows a runner group can run{% endif %}. For runner groups in an organization, you can change what repositories in the organization can access a runner group{% if restrict-groups-to-workflows %} or restrict what workflows a runner group can run{% endif %}.
129+
130+
### Changing what organizations or repositories can access a runner group
131+
125132
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %}
126133
{% data reusables.actions.self-hosted-runner-groups-navigate-to-repo-org-enterprise %}
127134
{% data reusables.actions.settings-sidebar-actions-runner-groups-selection %}
128-
1. Modify the access options, or change the runner group name.
135+
1. For runner groups in an enterprise, under **Organization access**, modify what organizations can access the runner group. For runner groups in an organization, under **Repository access**, modify what repositories can access the runner group.
129136

130137
{%- ifversion fpt or ghec or ghes %}
131138
{% warning %}
@@ -142,6 +149,35 @@ You can update the access policy of a runner group, or rename a runner group.
142149
{% data reusables.actions.self-hosted-runner-configure-runner-group-access %}
143150
{% endif %}
144151

152+
{% if restrict-groups-to-workflows %}
153+
### Changing what workflows can access a runner group
154+
You can configure a self-hosted runner group to run either selected workflows or all workflows. For example, you might use this setting to protect secrets that are stored on self-hosted runners or to standardize deployment workflows by restricting a runner group to run only a specific reusable workflow. This setting cannot be overridden if you are configuring an organization's runner group that was shared by an enterprise.
155+
{% data reusables.actions.self-hosted-runner-groups-navigate-to-repo-org-enterprise %}
156+
{% data reusables.actions.settings-sidebar-actions-runner-groups-selection %}
157+
1. Under **Workflow access**, select the dropdown menu and click **Selected workflows**.
158+
1. Click {% octicon "gear" aria-label="the gear icon" %}.
159+
1. Enter a comma separated list of the workflows that can access the runner group. Use the full path, including the repository name and owner. Pin the workflow to a branch, tag, or full SHA. For example: `octo-org/octo-repo/.github/workflows/build.yml@v2, octo-org/octo-repo/.github/workflows/deploy.yml@d6dc6c96df4f32fa27b039f2084f576ed2c5c2a5, monalisa/octo-test/.github/workflows/test.yml@main`.
160+
161+
Only jobs directly defined within the selected workflows will have access to the runner group.
162+
163+
Organization-owned runner groups cannot access workflows from a different organization in the enterprise; instead, you must create an enterprise-owned runner group.
164+
165+
1. Click **Save**.
166+
167+
{% endif %}
168+
169+
## Changing the name of a runner group
170+
171+
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5091 %}
172+
{% data reusables.actions.self-hosted-runner-groups-navigate-to-repo-org-enterprise %}
173+
{% data reusables.actions.settings-sidebar-actions-runner-groups-selection %}
174+
1. Change the runner group name.
175+
176+
{% elsif ghae or ghes < 3.4 %}
177+
{% data reusables.actions.self-hosted-runner-configure-runner-group %}
178+
1. Change the runner group name.
179+
{% endif %}
180+
145181
{% ifversion ghec or ghes or ghae %}
146182
## Automatically adding a self-hosted runner to a group
147183

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ This list describes the recommended approaches for accessing repository data wit
265265

266266
{% ifversion fpt or ghec %}As a result, self-hosted runners should almost [never be used for public repositories](/actions/hosting-your-own-runners/about-self-hosted-runners#self-hosted-runner-security-with-public-repositories) 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{% ifversion fpt or ghes > 3.1 or ghae or ghec %}, depending on its settings, can grant {% else %} grants {% endif %}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.
267267

268-
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. For more information, see "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)."
268+
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 {% if restrict-groups-to-workflows %}workflows, {% endif %}organizations and repositories can access runner groups. For more information, see "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)."
269269

270270
You should also consider the environment of the self-hosted runner machines:
271271
- What sensitive information resides on the machine configured as a self-hosted runner? For example, private SSH keys, API access tokens, among others.

content/actions/using-workflows/reusing-workflows.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,5 @@ For information about using the REST API to query the audit log for an organizat
307307
## Next steps
308308

309309
To continue learning about {% data variables.product.prodname_actions %}, see "[Events that trigger workflows](/actions/learn-github-actions/events-that-trigger-workflows)."
310+
311+
{% if restrict-groups-to-workflows %}You can standardize deployments by creating a self-hosted runner group that can only execute a specific reusable workflow. For more information, see "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups)."{% endif %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Issue 6137
2+
# Restrict self-hosted runner groups to specific workflows
3+
versions:
4+
ghec: '*'
5+
ghes: '>=3.5'
6+
ghae: 'issue-6137'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% if restrict-groups-to-workflows %}
2+
{% note %}
3+
4+
**Note:** Configuring the workflows that can access a runner group is currently in beta and subject to change.
5+
6+
{% endnote %}
7+
{% endif %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
1. Enter a name for your runner group, and assign a policy for organization access.
1+
1. Assign a policy for organization access.
22

33
You can configure a runner group to be accessible to a specific list of organizations, or all organizations in the enterprise.{% ifversion ghec or ghes %} By default, only private repositories can access runners in a runner group, but you can override this. This setting can't be overridden if configuring an organization's runner group that was shared by an enterprise.{% endif %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
1. Enter a name for your runner group, and assign a policy for repository access.
1+
1. Assign a policy for repository access.
22

33
You can configure a runner group to be accessible to a specific list of repositories, or to all repositories in the organization.{% ifversion ghec or ghes %} By default, only private repositories can access runners in a runner group, but you can override this. This setting can't be overridden if configuring an organization's runner group that was shared by an enterprise.{% endif %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{%- if restrict-groups-to-workflows %}
2+
1. Assign a policy for workflow access.
3+
4+
You can configure a runner group to be accessible to a specific list of workflows, or to all workflows. This setting can't be overridden if you are configuring an organization's runner group that was shared by an enterprise. If you specify what workflow can access the runner group, you must use the full path to the workflow, including the repository name and owner, and you must pin the workflow to a branch, tag, or full SHA. For example: `octo-org/octo-repo/.github/workflows/build.yml@v2, octo-org/octo-repo/.github/workflows/deploy.yml@d6dc6c96df4f32fa27b039f2084f576ed2c5c2a5, monalisa/octo-test/.github/workflows/test.yml@main`.
5+
6+
Only jobs directly defined within the selected workflows will have access to the runner group.{%- endif %}

data/reusables/actions/self-hosted-runner-configure-runner-group-access.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
1. In the {% ifversion fpt or ghes > 3.1 or ghae or ghec %}"Runners"{% else %}"Self-hosted runners"{% endif %} section of the settings page, click {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %} next to the runner group you'd like to configure, then click **Edit name and [organization|repository] access**.
2-
![Manage repository permissions](/assets/images/help/settings/actions-runner-manage-permissions.png)
3-
1. Modify your policy options, or change the runner group name.
1+
{% data reusables.actions.self-hosted-runner-configure-runner-group %}
2+
1. Modify your policy options.
43

54
{% ifversion not ghae %}
65
{% warning %}

0 commit comments

Comments
 (0)