Interview Prep/GitHub Actions/Security Hardening & Supply Chain

You are asked to harden an existing repo's workflows in one week. What is your checklist?

IntermediateScenarioSecurity Hardening & Supply Chain
Answer

Situation read → Fast, high-impact controls first.

What I'd do →

  1. Set default workflow permissions to read-only; add permissions: contents: read at the top of every workflow and per-job grants.
  2. Pin all third-party actions to SHAs; add Dependabot for github-actions.
  3. Run zizmor and actionlint; fix script injection and pull_request_target usage.
  4. persist-credentials: false on checkout where pushing is not needed.
  5. Move cloud keys to OIDC; environment protection on prod.
  6. CODEOWNERS on .github/; restrict allowed actions at org level.
  7. Fork PR approval required for outside contributors.

Why → These close the most exploited paths: token abuse, mutable dependencies, and injection.

Interview tip → Lead with "least-privilege token and SHA pinning", the two controls every reviewer expects.

All GitHub Actions questions Roadmap: GitHub Actions

More on Security Hardening & Supply Chain