Interview Prep/Git & GitHub/Security: secrets, signing, access and supply chain

How do you harden GitHub Actions workflows against injection?

AdvancedProductionSecurity: secrets, signing, access and supply chain
Answer

Never interpolate untrusted values (github.event.pull_request.title, branch names, issue bodies) directly in run:. Pass them through env: and quote them in the shell, set minimal permissions, avoid pull_request_target with checkout of PR code, restrict allowed actions at org level, and run zizmor or actionlint in CI.

- env:
    TITLE: ${{ github.event.pull_request.title }}
  run: echo "$TITLE"
All Git & GitHub questions Roadmap: Git & GitHub

More on Security: secrets, signing, access and supply chain