Skip to content

Commit b19ab4f

Browse files
committed
extending guidance following review
1 parent 00c7ced commit b19ab4f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

practices/actions-best-practices.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ This guide outlines best practices for securing your GitHub Actions workflows an
1919

2020
## Secrets Management
2121

22+
This section describes how secrets in GitHub Actions should be managed, teams should ensure that they are using robust secrets management tools such as Azure Key Vault and AWS Secrets Manager for securely storing secrets.
23+
2224
### Use GitHub Secrets
2325

2426
- Store sensitive data (API tokens, credentials, etc.) as [GitHub Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets)
@@ -55,7 +57,7 @@ jobs:
5557
5658
### Use Least Privilege Principle
5759
58-
Limit the GitHub token permissions to only what's necessary:
60+
Limit the GitHub token permissions to only what's necessary please [see here](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#permissions-for-the-github_token) for details on the default permissions that the github token is given when the permissions block is not used:
5961
6062
```yaml
6163
permissions:
@@ -66,6 +68,8 @@ permissions:
6668
6769
### Use Fine-Grained Tokens
6870
71+
Fine grained tokens *must* only be used if the GitHub token can not be used.
72+
6973
- Create custom GitHub Apps with limited scopes when possible
7074
- Use repository-scoped tokens instead of organization-wide tokens
7175
@@ -83,7 +87,7 @@ To mitigate these risks, always follow best practices, such as pinning actions t
8387
8488
### Pin Actions to Specific Versions
8589
86-
When including a GitHub Action within your workflow you should perform due diligence checks to ensure that the action achieves the aims you are intending it to, and that it doesn't do anything unintended, this would include performing a code review of the GitHub action code. To prevent the underlying code being changed without your awareness always use specific commit SHAs instead of tags or branches:
90+
When including a GitHub Action within your workflow you should perform due diligence checks to ensure that the action achieves the aims you are intending it to, and that it doesn't do anything unintended, this would include performing a code review of the GitHub action code. To prevent the underlying code being changed without your awareness always use specific commit SHAs instead of tags or branches as tags can be modified if the upstream repository is compromised:
8791
8892
```yaml
8993
# Not secure - can change unexpectedly
@@ -96,6 +100,8 @@ When including a GitHub Action within your workflow you should perform due dilig
96100
97101
### Verify Third-Party Actions
98102
103+
When including a GitHub Action within your workflow consider alternatives, is there an existing mechanism you can use? Would this be something that could be reused and you could create your own action within the organisation that other teams could benefit from? If you can only achieve your goal with a third-party action then:
104+
99105
- Only use trusted actions from the GitHub Marketplace
100106
- Review the source code of third-party actions before using them
101107
- Consider forking and maintaining your own copy of critical actions
@@ -120,7 +126,7 @@ When including a GitHub Action within your workflow you should perform due dilig
120126
121127
### Self-hosted Runner Security
122128
123-
If using self-hosted runners:
129+
Self-hosted runners *must* only be [used with private repositories](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#self-hosted-runner-security). If using self-hosted runners:
124130
125131
- Run them in isolated environments (containers/VMs)
126132
- Regularly update and patch runner machines

0 commit comments

Comments
 (0)