Interview Prep/GitHub Actions/Security Hardening & Supply Chain

You must prove that a container image in prod was built by your CI from a specific commit. How?

AdvancedScenarioSecurity Hardening & Supply Chain
Answer

Situation read → Build provenance and verification at deploy time.

What I'd do →

  1. In the build job, actions/attest-build-provenance on the pushed digest (id-token: write, attestations: write).
  2. Before deploy, gh attestation verify oci://$IMAGE@$DIGEST --owner devopsshack --signer-workflow devopsshack/shack-api/.github/workflows/cd.yml.
  3. In-cluster, enforce with Kyverno verifyImages or Sigstore policy-controller requiring provenance from your workflow identity.

Why → Signed provenance ties the digest to repo, workflow, commit and run, and admission policy makes it mandatory.

Interview tip → Mention SLSA levels; this setup gives SLSA build level 2 to 3 characteristics on hosted runners.

All GitHub Actions questions Roadmap: GitHub Actions

More on Security Hardening & Supply Chain