@@ -7,6 +7,7 @@ GitHub Actions is a powerful automation tool that enables CI/CD workflows direct
77This guide outlines best practices for securing your GitHub Actions workflows and minimizing security risks.
88
99## Table of Contents
10+
1011- [ Secrets Management] ( #secrets-management )
1112- [ Limiting Permissions] ( #limiting-permissions )
1213- [ Third-Party Actions] ( #third-party-actions )
@@ -28,7 +29,8 @@ This guide outlines best practices for securing your GitHub Actions workflows an
2829- Ensure a secret scanner is deployed as part of your workflows
2930- Public repositories should enable GitHub Secret Scanner and Push Protection
3031
31- ### Minimize Secret Scope
32+ ### Minimize Secret Scope
33+
3234``` yaml
3335# Good practice - limiting secret to specific environment
3436jobs :
5355
5456### Use Least Privilege Principle
5557
56- Limit the GitHub token permissions to only what's necessary:
58+ Limit the GitHub token permissions to only what's necessary:
59+
5760` ` ` yaml
5861permissions :
5962 contents : read
@@ -80,7 +83,7 @@ To mitigate these risks, always follow best practices, such as pinning actions t
8083
8184### Pin Actions to Specific Versions
8285
83- Always use specific commit SHAs instead of tags or branches:
86+ Always use specific commit SHAs instead of tags or branches:
8487
8588` ` ` yaml
8689# Not secure - can change unexpectedly
@@ -203,7 +206,7 @@ jobs:
203206- Enforce code reviews for workflow file changes
204207- Use CODEOWNERS to restrict who can modify workflow files
205208
206- ` ` `
209+ ` ` ` plaintext
207210# CODEOWNERS file/.github/workflows/ @security-team
208211```
209212
0 commit comments