Skip to content

Commit 00c7ced

Browse files
committed
updating guidance, to include account id as a secret, splitting out list further and adding guidance around due diligence when using GitHub actions
1 parent d5b5bda commit 00c7ced

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

practices/actions-best-practices.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ To mitigate these risks, always follow best practices, such as pinning actions t
8383
8484
### Pin Actions to Specific Versions
8585
86-
Always use specific commit SHAs instead of tags or branches:
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:
8787
8888
```yaml
8989
# Not secure - can change unexpectedly
9090
- uses: actions/checkout@v3
9191
# Better - using a specific version tag
9292
- uses: actions/[email protected]
9393
# Best - using a specific commit SHA
94-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
94+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.1.0
9595
```
9696
9797
### Verify Third-Party Actions
@@ -123,7 +123,9 @@ Always use specific commit SHAs instead of tags or branches:
123123
If using self-hosted runners:
124124
125125
- Run them in isolated environments (containers/VMs)
126-
- Regularly update and patch runner machines- Implement proper network isolation- Use ephemeral runners when possible
126+
- Regularly update and patch runner machines
127+
- Implement proper network isolation
128+
- Use ephemeral runners when possible
127129
128130
```yaml
129131
jobs:
@@ -185,7 +187,7 @@ jobs:
185187
- name: Configure AWS credentials
186188
uses: aws-actions/configure-aws-credentials@v1
187189
with:
188-
role-to-assume: arn:aws:iam::123456789012:role/github-actions
190+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions
189191
aws-region: eu-west-2
190192
```
191193

0 commit comments

Comments
 (0)