Interview Prep/CI/CD/Supply Chain and Pipeline Security

How do you harden GitHub Actions workflows overall?

IntermediateProductionSupply Chain and Pipeline Security
Answer
  • permissions: contents: read at top; elevate per job.
  • Pin third-party actions to commit SHAs; Dependabot to update them.
  • Allow-list actions at org level.
  • No ${{ github.event.* }} interpolation inside run:; use env vars.
  • Prefer OIDC to static cloud secrets; environment-scoped secrets with reviewers.
  • persist-credentials: false on checkout.
  • Ephemeral runners; no self-hosted runners on public repos.
  • Lint with actionlint and zizmor; CODEOWNERS on .github/workflows.
  • Use harden-runner style egress monitoring for sensitive workflows.
All CI/CD questions

More on Supply Chain and Pipeline Security