Skip to content

Add recommendations for runner groups and labels#91

Open
konstruktoid wants to merge 6 commits into
github:mainfrom
konstruktoid:rungroup
Open

Add recommendations for runner groups and labels#91
konstruktoid wants to merge 6 commits into
github:mainfrom
konstruktoid:rungroup

Conversation

@konstruktoid
Copy link
Copy Markdown

@konstruktoid konstruktoid commented May 22, 2026

This pull request makes several improvements to the documentation on securing GitHub Actions workflows. The most significant updates include adding new recommendations for segregating runners, enhancing repository ruleset guidance, and updating author attribution.

Enhancements to security recommendations:

  • Added a new recommendation to segregate runners by using organizational runner groups and labels to separate high-privilege from low-privilege runners, reducing the risk of unauthorized access to sensitive resources. [1] [2]
  • Expanded repository ruleset guidance by recommending the use of "Require workflows to pass before merging" to enforce organizational or enterprise-level workflow requirements prior to merging.

Documentation and metadata updates:

  • Updated the authors list in the document metadata to include Thomas Sjögren (konstruktoid).

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 22, 2026 16:03
@konstruktoid konstruktoid requested review from a team as code owners May 22, 2026 16:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the “Securing GitHub Actions Workflows” guidance by adding runner-segregation recommendations and expanding ruleset guidance, while marking the page as draft.

Changes:

  • Set the page to draft: true and added an additional author.
  • Added “Segregate runners” as a top-level recommendation and a dedicated section with implementation details.
  • Added a repository ruleset recommendation to require workflows to pass before merging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread content/library/application-security/recommendations/actions-security/index.md Outdated
Comment thread content/library/application-security/recommendations/actions-security/index.md Outdated
Comment thread content/library/application-security/recommendations/actions-security/index.md Outdated
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
10. **Use `head.sha` instead of `head.ref`**: Where possible, reference by commit SHA instead of a user-provided branch name or tag (ref), especially in sensitive contexts (such as `run` steps). If require, use environment variable to store `head.ref` and reference it to prevent injection attack.
11. **Use caution with public repositories**: Anyone can suggest changes to public repositories. Review workflow triggers, and never use self-hosted runners with public repositories.
12. **Restrict allowed actions**: Use the [*Allow enterprise, and select non-enterprise, actions and reusable workflows*](https://docs.github.com/en/enterprise-cloud@latest/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#controlling-access-to-public-actions-and-reusable-workflows) setting to control which actions can run.
13. **Segregate runners**: Use runner groups and labels to separate high-privilege runners (with access to secrets, sensitive resources or host access) from low-privilege runners.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you clarify secrets use here? you can't restrict github actions secrets per runner/runner. You can however restrict runner usage to selected workflows/reusable

You can also restrict them to a subset of repos

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was referring to using eg "selected repositories" in a runner group.
and yes, the runner itself isn't restricted per se, but limiting certain repositories to a specific group of runners limits the access of too many secrets.

Comment thread content/library/application-security/recommendations/actions-security/index.md Outdated

Use [runner groups](https://docs.github.com/en/actions/concepts/runners/runner-groups) and [labels](https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/apply-labels) to separate high-privilege runners from low-privilege runners. High-privilege runners may have access to sensitive resources or direct host access, while low-privilege runners should not.

This separation provides more granular control over [which repositories can access different runners](https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/manage-access#changing-which-repositories-can-access-a-runner-group) and which [jobs can access specific runners](https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/choose-the-runner-for-a-job). It also reduces the risk that a compromised or misconfigured workflow could gain access to sensitive resources.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify the "which jobs can access specific runners" ? this cannot be enforced once a repo has access to a given runner (you can restrict which workflows can use the runner but not the jobs) any job can use it.

Unless you restrict the workflows that can access a runner if a user can author workflows in a repo which has access to the runner it can use it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it's actually workflows but https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/choose-the-runner-for-a-job#choosing-self-hosted-runners says "To specify a self-hosted runner for your job, configure runs-on in your workflow file with self-hosted runner labels." and "When you combine groups and labels, the runner must meet both requirements to be eligible to run the job." (https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/use-in-a-workflow#using-labels-and-groups-to-route-jobs).


- A runner group for container image build runners, limited to only the repositories that require those privileges.
- A runner group for runners with access to restricted networks.
- A separate low-privilege runner group for tasks such as linting and static analysis, with no access to secrets or sensitive resources.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the mechanism you are considering to prevent a runner from having access to actions secrets?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that needs rewording, what i meant to say was that if a repository only have workflows that perform linting, code analysis that in many cases doesn't need access to any secrets or privileged runners (container-in-container for example) secrets shouldn't be present in the repository at all or at least in seperate environments.

@konstruktoid konstruktoid deployed to development May 27, 2026 12:20 — with GitHub Actions Active
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Comment thread content/library/application-security/recommendations/actions-security/index.md Outdated
10. **Use `head.sha` instead of `head.ref`**: Where possible, reference by commit SHA instead of a user-provided branch name or tag (ref), especially in sensitive contexts (such as `run` steps). If require, use environment variable to store `head.ref` and reference it to prevent injection attack.
11. **Use caution with public repositories**: Anyone can suggest changes to public repositories. Review workflow triggers, and never use self-hosted runners with public repositories.
12. **Restrict allowed actions**: Use the [*Allow enterprise, and select non-enterprise, actions and reusable workflows*](https://docs.github.com/en/enterprise-cloud@latest/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#controlling-access-to-public-actions-and-reusable-workflows) setting to control which actions can run.
13. **Segregate runners**: Use runner groups and labels to separate high-privilege runners (with access to secrets, sensitive resources or host access) from low-privilege runners.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally speaking, labels are not a best practice and tend to create long-term administrative difficulty. They are currently only available with self-hosted runners, which are also not recommended over GitHub-hosted from a security perspective

Suggested change
13. **Segregate runners**: Use runner groups and labels to separate high-privilege runners (with access to secrets, sensitive resources or host access) from low-privilege runners.
13. **Segregate runners**: Use runner groups to separate high-privilege runners (with access to sensitive resources) from low-privilege runners.

Copy link
Copy Markdown
Author

@konstruktoid konstruktoid May 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very true, but they are in use when it comes to GitHub Enterprise servers and regarding labels so are they also the only options if you don't have organizations available as a user.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to write, that they, as in self-hosted runners, are in use when it comes to GitHub Enterprise servers

Comment thread content/library/application-security/recommendations/actions-security/index.md Outdated
…ecurity/index.md

Co-authored-by: Ken Muse <kenmuse@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants