Most CI security advice is written for someone who already has a security team. This is the version for the person who owns the workflow file and has twenty minutes.
Everything below is a check you can run against a repository you already have. No tools to buy, no platform migration.
1. Pin third-party actions to a commit SHA, not a tag
# wrong: a tag can be moved to new code at any time - uses : some-org/some-action@v3
# right: this exact commit - uses : some-org/some-action@8f4b7c1e9d2a6b3c4d5e6f7a8b9c0d1e2f3a4b5c # v3.2.1
Enter fullscreen mode
Exit fullscreen mode
A tag is a mutable pointer. If the action's repository is compromised, @v3 starts running attacker code with your token on the next push. A SHA cannot be moved.
Keep the version in a comment so Dependabot can still bump it.
2. Give GITHUB_TOKEN nothing it does not need
Default permissions are wider than most jobs require.β¦