Interview Prep/DevSecOps/Container and IaC Security

How do you set up image scanning so nothing vulnerable reaches production?

IntermediateScenarioContainer and IaC Security
Answer

Situation read → Scanning in CI alone is not enough, since images can be pushed from elsewhere and age after the build.

What I'd do →

  1. Scan in CI and fail on policy: trivy image --exit-code 1 --severity CRITICAL --ignore-unfixed $IMAGE.
  2. Enable registry scanning (ECR enhanced scanning, Harbor with Trivy) for continuous rescans.
  3. Allow only images from your registry via admission policy.
  4. Require a signature and attestation of a passed scan at admission (Kyverno verifyImages).
  5. Alert on new CVEs for images already deployed.

Why → The build-time gate stops bad images, admission stops bypasses, continuous scan handles aging.

Interview tip → Describe it as three layers: build, registry, cluster.

All DevSecOps questions Roadmap: Policy as code

More on Container and IaC Security